[symfony-users] Re: Avoid blank embed form to be saved

2010-07-30 Thread J_Wesker
Great suggestion! I actually found the answer yesterday... although I'm not sure if it's good practice, I just had to add an else condition in my saveEmbeddedForms() method to set the relationship with the main object, instead of forcing the relationship from the beginning. This is the updated co

[symfony-users] Re: Avoid blank embed form to be saved

2010-07-30 Thread Tom Ptacnik
I think that easy solution is to overwrite the save method of the object wich is on the embeded form. Just test if there are some values and if not, end the method. If yes, call parent::save() On 30 čnc, 01:51, J_Wesker wrote: > After making some changes on my code and debugging using die's and

[symfony-users] Re: Avoid blank embed form to be saved

2010-07-29 Thread J_Wesker
After making some changes on my code and debugging using die's and var_dump() all day, I haven't found the cause of all this. But I have make sure of some facts: 1. If I embed directly the comment form, and set the body field as required, then both objects get saved smoothly, unfortunately the bus

Re: [symfony-users] Re: Avoid blank embed form to be saved

2010-07-29 Thread Gustavo Adrian
Sorry, my mistake. I thought the "getValue" method returned false instead of null. What I don't see is the validator set on the Expense form. Set it as the PostValidator On Thu, Jul 29, 2010 at 3:03 PM, J_Wesker wrote: > Why would it be always false? > > In the validator I'm unsetting the comm

[symfony-users] Re: Avoid blank embed form to be saved

2010-07-29 Thread J_Wesker
Why would it be always false? In the validator I'm unsetting the comment reference if body field has no value... wrote: > Sorry, the last line I was talking about is: > > *if** (**!**isset**(**$comment**)) > { >     **unset**(**$forms**[**'**comment**'**]); > > } > > The if condition would be al