|
29 | 29 | <xsl:template match='object'> |
30 | 30 | <xsl:element name='entity' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
31 | 31 | <xsl:attribute name='name'><xsl:value-of select='$objectNamespace'/><xsl:value-of select='@name'/></xsl:attribute> |
32 | | - <xsl:element name='id' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
33 | | - <xsl:attribute name='name'>id</xsl:attribute> |
34 | | - <xsl:attribute name='type'>integer</xsl:attribute> |
35 | | - |
36 | | - <xsl:element name='generator' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
37 | | - <xsl:attribute name='strategy'>AUTO</xsl:attribute> |
38 | | - </xsl:element> |
39 | | - <xsl:element name='sequence-generator' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
40 | | - <xsl:attribute name='sequence-name'> |
41 | | - <xsl:call-template name='lower-case'> |
42 | | - <xsl:with-param name='value' select='@name'/> |
43 | | - </xsl:call-template> |
44 | | - <xsl:text>_seq</xsl:text> |
45 | | - </xsl:attribute> |
46 | | - <xsl:attribute name='allocation-size'>100</xsl:attribute> |
47 | | - <xsl:attribute name='initial-value'>1</xsl:attribute> |
48 | | - </xsl:element> |
49 | | - </xsl:element> |
| 32 | + <xsl:apply-templates select='self::node()' mode='entityIdentifier'/> |
50 | 33 | <xsl:apply-templates select='fields/field'/> |
51 | 34 | <xsl:apply-templates select='fields/field' mode='fieldEntityReference'/> |
52 | 35 | </xsl:element> |
53 | 36 | </xsl:template> |
54 | 37 |
|
| 38 | + <!-- |
| 39 | + Add an id field to an entity. |
| 40 | + --> |
| 41 | + <xsl:template match='object' mode='entityIdentifier'> |
| 42 | + <xsl:element name='id' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
| 43 | + <xsl:attribute name='name'>id</xsl:attribute> |
| 44 | + <xsl:attribute name='type'>integer</xsl:attribute> |
| 45 | + |
| 46 | + <xsl:element name='generator' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
| 47 | + <xsl:attribute name='strategy'>AUTO</xsl:attribute> |
| 48 | + </xsl:element> |
| 49 | + <xsl:element name='sequence-generator' namespace='http://doctrine-project.org/schemas/orm/doctrine-mapping'> |
| 50 | + <xsl:attribute name='sequence-name'> |
| 51 | + <xsl:call-template name='lower-case'> |
| 52 | + <xsl:with-param name='value' select='@name'/> |
| 53 | + </xsl:call-template> |
| 54 | + <xsl:text>_seq</xsl:text> |
| 55 | + </xsl:attribute> |
| 56 | + <xsl:attribute name='allocation-size'>100</xsl:attribute> |
| 57 | + <xsl:attribute name='initial-value'>1</xsl:attribute> |
| 58 | + </xsl:element> |
| 59 | + </xsl:element> |
| 60 | + </xsl:template> |
| 61 | + |
| 62 | + <!-- |
| 63 | + Don't add an id field to an entity when an id field is defined in a orm/field-defined. |
| 64 | + --> |
| 65 | + <xsl:template match='object[orm/field-defined[@name = "id"]]' mode='entityIdentifier'/> |
| 66 | + |
55 | 67 | <!-- |
56 | 68 | Add a field mapping to an entity. |
57 | 69 | --> |
|
0 commit comments