Skip to content

Commit

Permalink
Changed XML translatable field names
Browse files Browse the repository at this point in the history
  • Loading branch information
szymach committed Jun 14, 2017
1 parent 454f0e0 commit 92ed885
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions doc/translatable/xml.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ XML for the entity:
</id>
<one-to-many field="translations" target-entity="Acme\DemoBundle\Entity\UserTranslation" mapped-by="user" index-by="locale" />

<fsi:locale field="locale" /><!-- "field" is required to point at which property the mapping points -->
<fsi:translatable field="name" mappedBy="translations" />
<fsi:translatable-locale field="locale" /><!-- "field" is required to point at which property the mapping points -->
<fsi:translatable-field field="name" mappedBy="translations" />
</entity>

</doctrine-mapping>
Expand Down Expand Up @@ -94,7 +94,7 @@ XML for the translation:

<field type="string" name="content" length="255"/>
<field type="string" name="locale" length="2">
<fsi:locale /><!-- No value needed, field name is used as locale property identifier -->
<fsi:translatable-locale /><!-- No value needed, field name is used as locale property identifier -->
</field>

<many-to-one field="user" target-entity="cme\DemoBundle\Entity\User" inversed-by="translations" />
Expand Down
8 changes: 4 additions & 4 deletions doctrine-extensions-mapping.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
<xs:attribute name="keyPattern" type="xs:string" use="optional"/>
</xs:complexType>

<xs:element name="translatable" type="fsi:translatable"/>
<xs:element name="translatable-field" type="fsi:translatable-field"/>

<xs:complexType name="translatable">
<xs:complexType name="translatable-field">
<xs:attribute name="mappedBy" type="xs:string" use="required"/>
<xs:attribute name="field" type="xs:string" use="required"/>
<xs:attribute name="targetField" type="xs:string" use="optional"/>
</xs:complexType>

<xs:element name="locale" type="fsi:locale"/>
<xs:element name="translatable-locale" type="fsi:translatable-locale"/>

<xs:complexType name="locale">
<xs:complexType name="translatable-locale">
<xs:attribute name="field" type="xs:string" use="optional" default="locale"/>
</xs:complexType>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

class Xml extends AbstractXmlDriver
{
const LOCALE = 'locale';
const FIELD_TRANSLATION = 'translatable';
const LOCALE = 'translatable-locale';
const FIELD_TRANSLATION = 'translatable-field';

/**
* {@inheritdoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
</id>
<one-to-many field="translations" target-entity="PageTranslation" mapped-by="page" index-by="locale" />

<fsi:locale field="locale" />
<fsi:translatable field="content" mappedBy="translations" />
<fsi:translatable-locale field="locale" />
<fsi:translatable-field field="content" mappedBy="translations" />
</entity>

</doctrine-mapping>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<field type="string" name="content" length="255"/>
<field type="string" name="locale" length="2">
<fsi:locale />
<fsi:translatable-locale />
</field>

<many-to-one field="page" target-entity="Page" inversed-by="translations" />
Expand Down

0 comments on commit 92ed885

Please sign in to comment.