On Wed, Sep 17, 2008 at 10:16 AM, Francois Zaninotto
<[EMAIL PROTECTED]> wrote:

>    $email = new sfEmail();
>    // then
>    $email->setHtmlBody(get_action('mymodule/myaction')); // well,
> get_action() is still to be written...
>    // or
>    $email->setBody(get_partial('mymodule/mypartial'));
>    // or
>    $email->setBody(get_component('mymodule/mycomponent'));
>    // or
>    $email->setBody('hello world');
>    // and maybe
>    $email->setBodyPart('text/html', '<p>hello world</p>');
>    // why not
>    $email->setBodyPart('application/pdf', file_get_contents('/tmp/toto.pdf'));
>    // there could be also call_user_func() and so on

My proposal of (see wiki page):

$email->setTemplate('text/html', new sfEmailTemplateAction('mail', 'foo'));

is quite similar, isn't it? And it will allow to set vars for the
whole email class and to having to pass them every time like this:

$vars = array('foo' => 'bar');
$email->setBody(get_partial('mymodule/mypartial', $vars));
$email->setBodyPart('txt/html', get_component('mymodule/mypartial', $vars));

But maybe this would be okay for everyone?

> So my question is: Shouldn't we work on a reusable syntax for
> get_partial() that is more OO and that could be learnt once and
> injected everywhere, rather than introducing many new classes that
> will only contain a few lines of code but that may prove longer to
> learn?

The sfEmailTemplateBase derived class would share the same really
simple interface, but you might be right there, I don't know. What do
others think? Express yourselves!

++

-- 
Nicolas Perriault
http://prendreuncafe.com - http://symfonians.net - http://sensiolabs.com
Phone: +33 660 92 08 67

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to