On 6 Feb., 14:27, "Philip Daly" <[EMAIL PROTECTED]> wrote:
> Matthias,
>
> I ran into a similar issue a while ago, but it's entirely possible the
> Doctrine or Admin Generator code has changed since then.
>
> However, I believe the problem was that the PK of one of the objects in the
> M2M relationship wasn't 'id'. And as I recall, there was some assumption in
> the code that 'id' was going to be the PK in the relationship, and it failed
> when that was not the case.
>
> My fix to this issue was to edit the Admin Generator (because my changing
> the name of my PK was a non-starter). The file would have been:
> /data/generator/sfDoctrineAdmin/<app>/template/templates/_edit_form.php . It
> was not recognizing my PK so I rewrote an if-statement to make an exception
> for my particular PK. A dirty-hack, but it worked in this particular case.

Oh yes.. it is what you said: The tables don't have 'id' as primary
key name.
Thanks you so much. :-)

I finally changed the isPrimaryKey if statement (line 48 or so) to
this line:
<?php if ($column->isPrimaryKey() && substr($column->getName(), 0, 1) !
== strtoupper(substr($column->getName(), 0, 1))) continue ?>

So simply all relations starting with an upper char will not be
skipped.
Really a dirty hack, but I seems to work now. :-)

regards,
Matthias

>
> -----Original Message-----
> Sent: February 6, 2008 5:36 AM
> Subject: [symfony-users] Problem with Doctrine, admin generator and m2m
>
> relation
>
> I'm using the admin generator with Doctrine. I have a m2m relation
> "Users". This relation seems to be configured correctly but the
> problem is the form field is not displayed at all in the admin
> generator.
>
> Unfortunately I get no error message, the field simply is not
> there.. :-(
>
> Anyone who also run into such a strange behavior in the past?
> Any ideas why that could happen?
>
> Regards,
> Matthias
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.516 / Virus Database: 269.19.20/1260 - Release Date: 2008-02-05
> 9:44 AM
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to