[Solved] Templates not used

0 votes
asked Apr 14, 2015 in Solved by floeH (430 points)
edited Oct 13, 2015 by ludek.vodicka

I followed introductions on http://help.skipper18.com/en/extending-templates and created a template file called "default_columns.skipper.cfg.xml". I have placed it in project folder where all *.ormdesigner files are. But when I'm going to create a new entity my default columns are not part of it. I have also tried to place this template file in /Applications/Skipper.app/Contents/Resources/Configurations/. Also not working.

Content of file:

<template element='entity' use-case='create' selector='primary-field'>
  <entity name="newEntity" description="Created by template">
    <field name="id" required="true" primary="true" auto-increment="true"/>
    <field name="createdAt" type="integer" size='255'/>
    <field name="updatedAt" type="integer" />
  </entity>
</template>

Best regards
Florian

commented Apr 14, 2015 by floeH (430 points)

1 Answer

+1 vote
answered Apr 14, 2015 by ludek.vodicka Skipper developer (140,450 points)
selected Apr 14, 2015 by floeH
 
Best answer

Hi,
the extension file has to have also directive elements (skipper-configuration, orm-configuration,... ) to be able to parse it correctly (and because it's necessary to tell Skipper for which ORM framework you're extending it).

This means something like this:

<skipper-configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <orm-configuration name="Doctrine2">
            <element-templates>
               <template element='entity' use-case='create' selector='new-project'>...
               ....

The best way how to start with templates is to edit existing Skipper configuration file. And as soon as you are satisfied with customized templates, create custom file like you're mentioning.

commented Apr 14, 2015 by floeH (430 points)

Works like a charm! Thanks!

...