0 votes

It seems the OnDelete property is incorrectly handled by ORMD.

When you select 'OnDelete' and set it to 'cascade' the parameter should be added to the <foreignkey> section in the rendered XML. Instead it ends up on as a property of the actual column, which breaks building the XML.

Also where is OnUpdate? I do not see it?

Reference: Propel's foreign key element doc

in Solved by (510 points)
recategorized by

2 Answers

0 votes
Best answer

Hi,

sorry for late reply but we were out of office. I checked it today and it seems that we have a typo in our cfg script which caused this problem.

Could you please try to edit file **Propel.ormd2.cfg.xml ** located inside the ORMD/Configurations and replace text on line 96 from

<struct name="Associations">

to

<struct name="Association">

After this update export looks like this:

<table name="e2">
  <column name="id" type="Integer" required="true" autoIncrement="true" primaryKey="true"/>
  <column name="sample_entity_id" type="integer" required="true"/>
  <foreign-key foreignTable="SampleEntity" onDelete="cascade" onUpdate="cascade" phpName="test" refPhpName="test2">
    <reference foreign="id" local="sample_entity_id"/>
  </foreign-key>
</table>
by Skipper developer (141k points)
selected by

Great, thank you for the fix!

I think there is still an issue with many-to-many associations. Clicking on those will not show the foreign key properties.

Try click on the red diamond inside the entity object. By clicking on the association line you're configuring only properties owned by specified side of association.

Tried it and it doesn't work for me. Clicking on the red diamond inside the many-to-many entity leaves the properties empty here.

You're right. I checked ORMD Propel configuration file and there is no ORM attributes for many-to-many.
What kind of properties are you looking for many-to-many and do you have any link to reference manual where all many-to-many properties are listed?

Well a many- to-many is also an association. In fact you can create your own many-to-many if you just associate two one-to-many to another table and make both fields primary keys. The many-to-many association in ORM designer just makes it more clear.

So I would say many-to-many associations have the same properties as normal associations unless someone disagrees.

Thanks for info. I'm not sure if it will be possible to duplicate all behaviors from common one-to-many.

I fully understand that creating many-to-many is more comfortable then two one-to-many associations, but many-to-many structure is internally implemented slightly different than two separate associations.

We will check it next week and let you know.

Have you already looked into this? Forgot about this issue but ran into it again today with a new project. Checked the latest beta but I see the issue still exists.

Normal associations can have properties onDelete, onUpdate, phpName and refPhpName but this is still missing in the many-to-many associations.

Hi, sorry for this delay. We already have a fix but we don't release it yet. Replace content of file Propel.ormd2.cfg with content from here: http://pastebin.com/pf5YiheF and attributes will works.

Yeah that works great. Thanks for the temporary fix and the quick reply. I'm always impresssed with the quick support from ORM Designer.

Thanks for your feedback, I'm glad it is working for you now. The fix will be part of the next version release.
Just let us know should you need anything more.

0 votes

Thanks for info, we will check it and let you know.

by Skipper developer (141k points)

Is there any news on this? Have you confirmed this is an actual bug?
Or am I doing something incorrectly?

It was a bug. Please check my reply.