Hi Bernhard, actually I had the logic in a postInsert method of the Client class, which IMO made the most sense. But this lead to the following surprise: When I used
$ symfony doctrine:data-load from a fixture with one client and one user I suddenly ended with two users instead of one. First data-load inserted the client and triggered the postInsert event, which created a user. Then data-load continued with adding a user, and hey presto, suddenly there were two :-( And I was forced to use mysqldump. I have always wondered why doctrine:data-load doesn't behave the same way like mysqldump, just dump and load sql data, which I expected by the name (data-dump and data-load)? I am forced to go along the controller/form solution, because for the test cases I need fresh data in the db, and mysqldump is not an option is this case. But this feels wrong. Georg Bernhard Schussek schrieb: > Hi Georg, > > Why don't you just override the save() method of the Client class? You > could, for example, check whether any user is associated with the > client and, if not, do it manually before calling parent::save(). > > I personally would prefer to put this logic into the form for creating > the Client though, because "magic" save-methods can lead to tricky > problems. Is this an option for you? > > Bernhard > > -- > > You received this message because you are subscribed to the Google Groups > "symfony users" group. > To post to this group, send email to symfony-us...@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. > > > -- You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-us...@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.