[Solved] Custom attributes on associations should have the option to export to Doctrine2 YAML

0 votes
asked Mar 5, 2013 in Solved by anonymous
recategorized Mar 13, 2013 by ludek.vodicka

Currently when you add custom attributes to Doctrine2.ormd2.cfg.xml file under the "Field" and "Entity" tags, these export to the Doctrine2 YAML without issue, but if you add custom attributes to under either or these do not export. We use a custom Doctrine YAML Driver that knows how to interpret these custom attributes. Please add either some option to export these or provide resources/examples on how I would go about doing this myself, if possible. Thanks!

2 Answers

0 votes
answered Mar 13, 2013 by ludek.vodicka Skipper developer (140,450 points)
selected Jul 30, 2014 by Martin Freki Stradej
 
Best answer

New version 2.1.10.697 with this feature/bugfix was released.
Please download latest version here http://www.orm-designer.com/download-orm-designer

0 votes
answered Mar 7, 2013 by ludek.vodicka Skipper developer (140,450 points)
edited Mar 7, 2013 by ludek.vodicka

Next ORM Designer version will contain following update:

We extended Doctrine2 export scripts to export custom properties for owner/inverse side and for association columns properties. Here is our test case:

Our custom configuration xml:

<struct name="Association">
  <attribute name="custom-root" .../>
    <struct name="side-owning">
  <attribute name="custom-owning"...>
  </struct>
  <struct name="side-inverse">
    <attribute name="custom-inverse"/>
  </struct>
</struct>

So our ORM Designer Property editor now looks like this:

http://i.imgur.com/MAiVYtI.png

If you fill properties like in our example, result doctrine XML will looks like this:

<entity name="E2">
...
  <many-to-one field="t1" target-entity="SampleEntity" inversed-by="t2" custom-owning="custom-owning">
    <join-columns>
      <join-column name="sample_entity_id" referenced-column-name="id" nullable="false" custom-root="custom-root"/>
    </join-columns>
  </many-to-one>
...
</entity>

<entity name="SampleEntity">
...
  <one-to-many field="t2" target-entity="E2" mapped-by="t1" custom-inverse="custom-inverse"/>
...
</entity>

And of course this same is true for YAML export format:

E2:
 ...
  manyToOne:
    t1:
    ...
      customOwning: custom-owning
      joinColumns:
        sample_entity_id:
          ...
          customRoot: custom-root
SampleEntity:
...
  oneToMany:
    t2:
      ...
      customInverse: custom-inverse

I hope we cover all possible variants. This update will be available in the next ORM Designer release.

...