src/CorporateTrainingBundle/CorporateTrainingBundle.php line 10

Open in your IDE?
  1. <?php
  2. namespace CorporateTrainingBundle;
  3. use AppBundle\Common\ExtensionalBundle;
  4. use Codeages\Biz\Framework\Dao\DaoProxy;
  5. use CorporateTrainingBundle\DependencyInjection\Compiler\ExtensionPass;
  6. use Symfony\Component\DependencyInjection\ContainerBuilder;
  7. class CorporateTrainingBundle extends ExtensionalBundle
  8. {
  9.     public function boot()
  10.     {
  11.         $biz $this->container->get('biz');
  12.         $directory $this->getPath().DIRECTORY_SEPARATOR.'Migrations';
  13.         if (is_dir($directory)) {
  14.             $biz['migration.directories'][] = $directory;
  15.         }
  16.         $directory $this->getPath().DIRECTORY_SEPARATOR.'Biz';
  17.         if (is_dir($directory)) {
  18.             $biz['autoload.aliases'][$this->getName()] = "{$this->getNamespace()}\\Biz";
  19.         }
  20.         $biz['autoload.object_maker.service'] = function ($biz) {
  21.             return function ($namespace$name) use ($biz) {
  22.                 $class "{$namespace}\\Service\\Impl\\{$name}Impl";
  23.                 if ('Biz\\' === substr($namespace0strlen('Biz\\'))) {
  24.                     $ctNamespace "{$this->getNamespace()}\\{$namespace}";
  25.                     $ctClass "{$ctNamespace}\\Service\\Impl\\{$name}Impl";
  26.                     if (class_exists($ctClass)) {
  27.                         $class $ctClass;
  28.                     }
  29.                 }
  30.                 return new $class($biz);
  31.             };
  32.         };
  33.         $biz['autoload.object_maker.dao'] = function ($biz) {
  34.             return function ($namespace$name) use ($biz) {
  35.                 $class "{$namespace}\\Dao\\Impl\\{$name}Impl";
  36.                 if ('Biz\\' === substr($namespace0strlen('Biz\\'))) {
  37.                     $ctNamespace "{$this->getNamespace()}\\{$namespace}";
  38.                     $ctClass "{$ctNamespace}\\Dao\\Impl\\{$name}Impl";
  39.                     if (class_exists($ctClass)) {
  40.                         $class $ctClass;
  41.                     }
  42.                 }
  43.                 return new DaoProxy($biz, new $class($biz), $biz['dao.metadata_reader'], $biz['dao.serializer']);
  44.             };
  45.         };
  46.         $this->container->get('api.resource.manager')->registerApi('CorporateTrainingBundle\Api');
  47.     }
  48.     public function build(ContainerBuilder $container)
  49.     {
  50.         $container->addCompilerPass(new ExtensionPass());
  51.     }
  52.     public function getEnabledExtensions()
  53.     {
  54.         return ['DataTag''StatusTemplate''DataDict''NotificationTemplate'];
  55.     }
  56.     public function getParent()
  57.     {
  58.         return 'AppBundle';
  59.     }
  60. }