Patter, Did you happen to email this week? Someone emailed me regarding this issue, and I just went to reply but I can't find the email. If it was or wasn't you, according to a changeset I have from a month or two ago I did get it to work correctly; however, I'm not exactly sure what I did. If you give me a day or two I'm going to be doing the exact same thing again for sfDoctrineUserPlugin to finish up some of the backend functionality and I'll point you towards the code on the symfony trac servers. It will have the exact same example you're looking for, especially since my User has Phones (1-n) which will need to be able to be added and deleted.
-- Stephen Ostrow <sost...@sowebdesigns.com> On Feb 11, 11:06 am, patter <p.vukadi...@gmail.com> wrote: > Hello, > > I have a 1:n relation: User have two phone numbers (well my real use > case is a bit complicated :-) ). > > In my UserForm::configure() I have something like this: > > $p1 = $this->object['phones'][0] = new Phone(); > $p2 = $this->object['phones'][1] = new Phone(); > > $subForm = new sfForm(); > $subForm->embedForm(0, new PhoneForm($p1 ); > $subForm->embedForm(1, new PhoneForm($p2)); > > $this->embedForm('phones', $subForm); > > This works perfect. I can add a new User with 2 phones. > > The problem is that if the user doesn't provide information for second > phone I should not insert a blank record (in fact I can't because of > not null fields). > > I have read a lot of articles but I'm not able to find solution yet. > > I think that I have to use UpdateObject() method to remove unwanted > relation, but if this is the better solution ? > > I use Doctrine :-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---