« Das MSSQL-DesasterMein Fan »

Symfony 1.2 / Propel: Patching, Hacking, Debugging

11.09.09

Permalink 03:31:33 am, by ff Email , 238 words   English (US) latin1
Categories: Computer, Internet

Symfony 1.2 / Propel: Patching, Hacking, Debugging

Working with Symfony and Propel is a piece of cake as long as you keep to the standard examples, but it starts getting kind of messy when it comes to real world DB schemata:

If you happen to define a foreign key in schema.yml that is not the primary key of the referenced table, the generated propel forms of the referenced table do weird things by assuming its primary key as the foreign key at saving time.
To correct that, just copy the saveXYZList() function(s) of the BaseXYZForm to the form-class and correct the $this->object->getPrimaryKey() to the appropriate foreign key function.

The sfValidatorPropelChoice doesn't seem to like combined indexes (of which it should just use just one column in my case): My understanding of a correct validation of a propel choice is, that at least one entry should exist for each key that was chosen in the form. What the validator does is generating a query like "SELECT * FROM A_ADRESSEN WHERE ADR_ID IN ('9', '10', '11')" which can give more than three results if ADR_ID is only a part of a combined index. Then it validates by comparing the amount of keys chosen in the form to the amount of results which is incorrect in that case. A workaround is to write a deviated class of sfValidatorPropelChoice, copy and patching the doClean() function for example by adding aggregation.

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
Mai 2012
Mo Di Mi Do Fr Sa So
 << <   > >>
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Suche

open source blog tool