Exemplo n.º 1
0
 public static function setUpBeforeClass()
 {
     if (!self::$loader) {
         self::$loader = \ClassGenerator\Autoloader::getInstance()->setCachePath(__DIR__ . DIRECTORY_SEPARATOR . 'cache')->register();
         self::$generator = self::$loader->getGenerator();
     }
 }
Exemplo n.º 2
0
 public function process(ContainerBuilder $container)
 {
     $mainGenerator = \ClassGenerator\Autoloader::getInstance()->getGenerator();
     $generators = $mainGenerator->getGenerators();
     $decorable = $generators['decorable'];
     foreach ($container->findTaggedServiceIds('cg.decorated') as $id => $tags) {
         $definition = $container->findDefinition($id);
         $definition->setClass($decorable->getClassName($definition->getClass()));
         foreach ($tags as $tag) {
             $definition->addMethodCall('cgDecorateWith', array(new Reference($tag['by'])));
         }
     }
 }
 protected function initAutoloader($kernel)
 {
     $this->autoloader = \ClassGenerator\Autoloader::getInstance();
     $this->autoloader->setCachePath($kernel->getCacheDir())->setEnabledCache($kernel->getEnvironment() != 'dev')->register();
 }