Author: Filip Procházka (filip@prochazka.su)
Inheritance: extends Nette\DI\CompilerExtension
コード例 #1
0
ファイル: OrmExtension.php プロジェクト: iPublikuj/doctrine
 public function beforeCompile()
 {
     parent::beforeCompile();
     // Get container builder
     $builder = $this->getContainerBuilder();
     // Get validators service
     $factory = $builder->getDefinition($this->prefix('validators'));
     foreach (array_keys($builder->findByTag(self::TAG_VALIDATOR)) as $serviceName) {
         // Register validator to service
         $factory->addSetup('registerValidator', ['@' . $serviceName, $serviceName]);
     }
 }
コード例 #2
0
ファイル: Helper.inc.php プロジェクト: cujan/vcelyweb
 /**
  * @return \TestPresenter
  */
 private function createPresenter()
 {
     $url = new \Nette\Http\UrlScript('http://localhost/');
     $url->setScriptPath('/');
     $configurator = new \Nette\Config\Configurator();
     $configurator->addConfig(__DIR__ . '/config.neon');
     \Kdyby\Events\DI\EventsExtension::register($configurator);
     \Kdyby\Annotations\DI\AnnotationsExtension::register($configurator);
     \Kdyby\Doctrine\DI\OrmExtension::register($configurator);
     $container = $configurator->setTempDirectory(TEMP_DIR)->createContainer();
     $container->removeService('httpRequest');
     $container->addService('httpRequest', new \Nette\Http\Request($url));
     $application = $container->getService('application');
     $application->router[] = new \Nette\Application\Routers\SimpleRouter();
     $presenter = new TestPresenter($container);
     $container->callInjects($presenter);
     $presenter->invalidLinkMode = $presenter::INVALID_LINK_WARNING;
     $presenter->autoCanonicalize = FALSE;
     return $presenter;
 }
コード例 #3
0
 protected function beforeSetUp()
 {
     ConsoleExtension::register($this->getConfigurator());
     OrmExtension::register($this->getConfigurator());
     EventsExtension::register($this->getConfigurator());
 }