Re: [symfony-users] Re: Sending mail from a Form class.

2010-07-04 Thread Bernhard Schussek
I disagree that this is a good use case for the event dispatcher. The event dispatcher is good for providing hooks for additional, _optional_ functionality (like logging, profiling etc.) Sending a mail upon form submission is not optional. This has to happen. You want to be able to test that it

[symfony-users] Re: Sending mail from a Form class.

2010-07-03 Thread cosmy
I don't embed the form.. where should i put this function if I want that an email is sent when a new article is posted (in the backend)? And why it doesn't work into the form class using sfContext::getInstance(), and it works in an action using $this ? @Richtermeister: I've never used

[symfony-users] Re: Sending mail from a Form class.

2010-07-02 Thread cosmy
On 2 Lug, 05:58, pghoratiu pghora...@gmail.com wrote: From the first one the actual send is missing:                   // send the email                   $this-getMailer()-send($mail);     gabriel It still doesn't work.. -- If you want to report a vulnerability issue on symfony, please

[symfony-users] Re: Sending mail from a Form class.

2010-07-02 Thread Johannes
doSave() is probably not the right place since it never gets called if you embed the PostForm somewhere. Johannes On Jul 2, 3:12 pm, cosmy c.zec...@gmail.com wrote: On 2 Lug, 05:58, pghoratiu pghora...@gmail.com wrote: From the first one the actual send is missing:                   //

[symfony-users] Re: Sending mail from a Form class.

2010-07-01 Thread pghoratiu
From the first one the actual send is missing: // send the email $this-getMailer()-send($mail); gabriel On Jul 2, 5:25 am, Cosimo Zecchi c.zec...@gmail.com wrote: Hi all.. I think it's a strange behavior: if I send email inside an   action it will be

[symfony-users] Re: Sending mail from a Form class.

2010-07-01 Thread Richtermeister
Hey there, overall this is a perfect case for using the eventdispatcher. That way you can keep the form focused on what it's good at (validation), and handle notifications outside. The form already has access to the eventdispatcher, so all it takes is firing an event that carries the post object