Fixed PHP-DI's fuckup
This commit is contained in:
parent
fabcea8185
commit
646b155b07
1 changed files with 6 additions and 2 deletions
|
@ -6,6 +6,7 @@ use Doctrine\Common\Cache\ArrayCache;
|
||||||
final class Injector
|
final class Injector
|
||||||
{
|
{
|
||||||
private static $container;
|
private static $container;
|
||||||
|
private static $definitionCache;
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
|
@ -14,8 +15,9 @@ final class Injector
|
||||||
. DIRECTORY_SEPARATOR . 'src'
|
. DIRECTORY_SEPARATOR . 'src'
|
||||||
. DIRECTORY_SEPARATOR . 'di.php';
|
. DIRECTORY_SEPARATOR . 'di.php';
|
||||||
|
|
||||||
|
self::$definitionCache = new ArrayCache();
|
||||||
$builder = new ContainerBuilder();
|
$builder = new ContainerBuilder();
|
||||||
$builder->setDefinitionCache(new ArrayCache());
|
$builder->setDefinitionCache(self::$definitionCache);
|
||||||
$builder->addDefinitions($definitionsPath);
|
$builder->addDefinitions($definitionsPath);
|
||||||
$builder->useAutowiring(true);
|
$builder->useAutowiring(true);
|
||||||
$builder->useAnnotations(false);
|
$builder->useAnnotations(false);
|
||||||
|
@ -29,7 +31,9 @@ final class Injector
|
||||||
|
|
||||||
public static function set($className, $object)
|
public static function set($className, $object)
|
||||||
{
|
{
|
||||||
return self::$container->set($className, $object);
|
self::$container->set($className, $object);
|
||||||
|
self::$definitionCache->delete($className);
|
||||||
|
self::$definitionCache->flushAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue