Le 21/02/2011 14:28, Geoffrey Bachelet a écrit :
Hi everyone,
I'm not sure if this issue (if it is at all an issue, still not sure
about that) as been raised already, in which case sorry for the noise,
but reading the email cookbook
(http://docs.symfony-reloaded.org/master/cookbook/email.html), I saw
that snippet of code:
$mailer = $this->get('mailer');
$message = \Swift_Message::newInstance()
Now, isn't (one of) the point of the DIC to eliminate component
coupling? If so, it seems totally defeated by the hard-coding of the
Swift_Message::newInstance() call.
Even if we admit that most people won't use anything else than
SwiftMailer, how do you handle this case in a unit test?
Regards,
Geoffrey
If you don't use swiftmailer you cannot use the code mailer service
anyway (as it is provided by SwiftmailerBundle).
You cannot provide a code working for both Swiftmailer and PHPmailer in
an agnostic way as they don't have the same API. So why is it bad to
write it there ?
Thus it is not about decoupling component. If your controller uses
Swiftmailer to send a mail it will have a dependency to Swiftmailer. the
DIC is about injecting the dependencies, not removing them.
--
Christophe | Stof
--
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 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