Skip to content

Instantly share code, notes, and snippets.

@pboethig
Last active December 31, 2016 09:00
Show Gist options
  • Select an option

  • Save pboethig/75a8bd6f8233211db3a7c1507e8f800b to your computer and use it in GitHub Desktop.

Select an option

Save pboethig/75a8bd6f8233211db3a7c1507e8f800b to your computer and use it in GitHub Desktop.
get container static
/**
* @var \Symfony\Component\DependencyInjection\Container
*/
private static $_container;
/**
* override parent getContainer() and save container staticly
*/
public function getContainer()
{
if(!self::$_container)
{
self::$_container = $this->container;
}
return $this->container;
}
/**
* @return \Symfony\Component\DependencyInjection\Container
*/
public static function getContainerStatic()
{
return self::$_container;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment