Created
January 25, 2012 17:52
-
-
Save kivi/1677586 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
notification: | |
class: Itembase\CoreBundle\Services\NotificationService | |
arguments: [@mailer, @doctrine.orm.entity_manager, @templating] | |
// as you can see we are injecting @mailer, @doctrine.orm.entity_manager, @templating | |
// You'll find this again in NotificationService constructor. | |
// that is a nice way to pass services arround. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this command uses the Notification Service | |
class ActivityStreamUpdaterCommand extends ContainerAwareCommand | |
{ | |
private $silentMode; | |
private function sendOutNotification($action, $payload, $user, $actorIdentifier, $actorName) | |
{ | |
if ($user->getUsername() != $actorIdentifier) { | |
// get a instance of NotificationService | |
$notifier = $this->getContainer()->get('notification'); | |
// now use the NotificationServer | |
$notifier->sendNotification( | |
$user, // Receiver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Itembase\CoreBundle\Services; | |
class NotificationService | |
{ | |
private $mailer; | |
private $em; | |
private $templating; | |
// constructor with params, that will be injected. | |
public function __construct(\Swift_Mailer $mailer, EntityManager $em, EngineInterface $templating) | |
{ | |
$this->em = $em; | |
$this->mailer = $mailer; | |
$this->templating = $templating; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// this command uses the Notification Service | |
class ActivityStreamUpdaterCommand extends ContainerAwareCommand | |
{ | |
private $silentMode; | |
private function sendOutNotification($action, $payload, $user, $actorIdentifier, $actorName) | |
{ | |
if ($user->getUsername() != $actorIdentifier) { | |
// get a instance of NotificationService | |
$notifier = $this->getContainer()->get('notification'); | |
// now use the NotificationServer | |
$notifier->sendNotification( | |
$user, // Receiver |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
namespace Itembase\CoreBundle\Services; | |
class NotificationService | |
{ | |
private $mailer; | |
private $em; | |
private $templating; | |
// constructor with params, that will be injected. | |
public function __construct(\Swift_Mailer $mailer, EntityManager $em, EngineInterface $templating) | |
{ | |
$this->em = $em; | |
$this->mailer = $mailer; | |
$this->templating = $templating; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment