Skip to content

Instantly share code, notes, and snippets.

@sadraskol
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sadraskol/016c2b840c4fcb184d51 to your computer and use it in GitHub Desktop.
Save sadraskol/016c2b840c4fcb184d51 to your computer and use it in GitHub Desktop.
services:
mailer:
class: Mailer
newsletter_manager:
class: NewsletterManager
dependencies:
mailer: Mailer
$newsletter = InjectionSingleton::inject('newsletter_manager');
$newsletter->doStuff();
class NewsletterManager {
public function __construct() {
InjectionSingleton::inject($this);
}
public function doStuff() {
$this->mailer->doOtherStuff();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment