Try to separate the logic of sending mails from the model. You should put it
on the pertinent action. Something like:

public function executeSetIsActivatedAndSendMail( $request )
{
    $this->myObject = $this->getRoute()->getObject();
    $value                = $request->getParameter( 'myValue' );

    $this->myObject->setIsActivated( $value );         // I'm avoiding any
validation concerns to simplify my example

    if ( $value )
    {
         // Send mail, handle errors
    }

    $this->myObject->save();
}


If you still want to encapsulate the mail logic on the model, then you
should create another method, like "setIsActivatedAndSendMail" to do the
trick, and call then manually the "save" method from the action.

BTW, the line that I guess is giving you trouble is the call to the parent
method "setIsActivated". What I'll tell you is just a guess so if anyone
could confirm or clarify this, it would be great: You can't call the parent
of such method because it isn't a "real method" per se. Instead, what you're
really calling is a magic method "__set". So, when you call the parent of
the "setIsActivated", you're calling the same method, so it falls in a
recursive call. I insist, it's just a guess.




Cheers.




On Tue, Aug 3, 2010 at 12:49 PM, Tristan <tristan.bessou...@gmail.com>wrote:

> Here is what apache is saying for the 2nd solution :
>
> [Tue Aug 03 17:45:32 2010] [notice] child pid 821 exit signal
> Segmentation fault (11)
> [Tue Aug 03 17:45:33 2010] [notice] child pid 824 exit signal
> Segmentation fault (11)
> [Tue Aug 03 17:45:33 2010] [notice] child pid 803 exit signal
> Segmentation fault (11)
> [Tue Aug 03 17:45:34 2010] [notice] child pid 828 exit signal
> Segmentation fault (11)
>
> PS: i've removed the $this->save() on the 2nd part but it still
> doesn't work.
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> 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<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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

Reply via email to