Exemplo n.º 1
0
 /**
  * Loads and returns bundle's Config.
  *
  * @param string $serviceId
  * @param string $baseDir
  *
  * @return
  */
 private function loadAndGetBundleConfigByBaseDir($serviceId, $baseDir)
 {
     $configId = str_replace('%bundle_service_id%', $serviceId, BundleInterface::CONFIG_SERVICE_ID_PATTERN);
     $this->loadConfigDefinition($configId, $baseDir);
     $bundleConfig = $this->container->get($configId)->getBundleConfig();
     if (isset($bundleConfig['config_per_site']) && true === $bundleConfig['config_per_site']) {
         $definition = $this->container->getDefinition($configId);
         $definition->addTag('config_per_site');
     }
     return $this->container->get($configId);
 }
Exemplo n.º 2
0
 /**
  * @param string     $id
  * @param Definition $definition
  * @param array      $definitionArray
  */
 private function tryHydrateDefinitionForRestoration($id, Definition $definition, array &$definitionArray)
 {
     if ($this->container->isLoaded($id) && $definition->hasTag('dumpable')) {
         $service = $this->container->get($id);
         if (!$service instanceof DumpableServiceInterface) {
             throw new ServiceNotDumpableException($id, get_class($service));
         }
         $classProxy = $service->getClassProxy() ?: get_class($service);
         if (!in_array(self::RESTORABLE_SERVICE_INTERFACE, class_implements($classProxy))) {
             throw new InvalidServiceProxyException($classProxy);
         }
         if (isset($definitionArray['class'])) {
             if ($classProxy !== $definitionArray['class']) {
                 unset($definitionArray['arguments']);
             }
             $definitionArray['class'] = $classProxy;
         }
         unset($definitionArray['configurator']);
         $definitionArray['calls'] = [];
         $definitionArray['calls'][] = ['restore', ['@service_container', $service->dump()]];
     }
 }
Exemplo n.º 3
0
 /**
  * Application's dependency injection container setters.
  *
  * @param ContainerInterface|null $container
  */
 public function setContainer(ContainerInterface $container = null)
 {
     $this->container = $container;
     $this->application = null !== $container ? $this->container->get('bbapp') : null;
 }