Skip to content

Instantly share code, notes, and snippets.

@frastel
Created November 26, 2012 16:30
Show Gist options
  • Save frastel/4149171 to your computer and use it in GitHub Desktop.
Save frastel/4149171 to your computer and use it in GitHub Desktop.
Don't pull your dependencies 5
<?php
namespace frastel\BlogPlaygroundBundle\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Log\LoggerInterface;
class DependencyPuller
{
private $logger;
private $mailer;
public function __construct(LoggerInterface $logger, \Swift_Mailer $mailer)
{
$this->logger = $logger;
$this->mailer = $mailer;
}
public function doSomething()
{
$result = false;
// do some fency stuff here
$result = true;
$this->logger->debug('before sending mail');
$message = \Swift_Message::newInstance()
->setSubject('Some subject')
->setTo('test@example.com')
->setBody('Some body');
$this->mailer->send($message);
$this->logger->debug('after sending mail');
return $result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment