Last active
December 31, 2016 09:00
-
-
Save pboethig/75a8bd6f8233211db3a7c1507e8f800b to your computer and use it in GitHub Desktop.
get container static
This file contains hidden or 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
| /** | |
| * @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