protected function makeConfiguration($packageConfiguration, $resourceName) { $class = DefinitionHelper::getClassImplementation($this->container, $resourceName, static::NAME, static::BASE_CLASS); $refClass = new \ReflectionClass($class); $methods = $refClass->getMethods(); $reader = $this->container->get('AnnotationReader'); $calls = array(); foreach ($methods as $method) { $annotations = $reader->getMethodAnnotations($method); foreach ($annotations as $annotation) { if ($annotation instanceof \EVFramework\Annotation\GeneratorCallDICIT) { $calls[$method->getName()] = array("@" . DefinitionHelper::getServiceName($this->container, $annotation->getResource(), $annotation->getType())); } } if ($method->getName() == 'setContainer') { $calls[$method->getName()] = array('$container'); } } $configuration = array('class' => $class, 'singleton' => 'true', 'arguments' => array('$container', $resourceName)); if (count($calls)) { $configuration['call'] = $calls; } // var_export($configuration); // die(); return $configuration; }
protected function makeConfiguration($packageConfiguration, $resourceName) { $managerName = DefinitionHelper::getServiceName($this->container, $resourceName, ManagerBuilder::NAME); $builderName = DefinitionHelper::getServiceName($this->container, $resourceName, BuilderBuilder::NAME); $class = DefinitionHelper::getClassImplementation($this->container, $resourceName, static::NAME, static::BASE_CLASS); $configuration = array('class' => $class, 'singleton' => 'true', 'arguments' => array('@' . $managerName, '@' . $builderName)); return $configuration; }
protected function makeConfiguration($packageConfiguration, $resourceName) { $pgStoreName = DefinitionHelper::getServiceName($this->container, $resourceName, 'PersistentStore'); $memcachedStoreName = DefinitionHelper::getServiceName($this->container, $resourceName, 'MemcachedStore'); $class = DefinitionHelper::getClassImplementation($this->container, $resourceName, static::NAME, static::BASE_CLASS); $configuration = array('class' => $class, 'singleton' => 'true', 'call' => array('addStore[1]' => array('@' . $pgStoreName))); return $configuration; }
protected function makeConfiguration($packageConfiguration, $resourceName) { $readerName = DefinitionHelper::getServiceName($this->container, $resourceName, ReaderBuilder::NAME); $writerName = DefinitionHelper::getServiceName($this->container, $resourceName, WriterBuilder::NAME); $class = DefinitionHelper::getClassImplementation($this->container, $resourceName, static::NAME, static::BASE_CLASS); $configuration = array('class' => $class, 'singleton' => 'true', 'call' => array('setReader' => array('@' . $readerName), 'setWriter' => array('@' . $writerName))); return $configuration; }
protected function makeConfiguration($packageConfiguration, $resourceName) { $validatorName = DefinitionHelper::getServiceName($this->container, $resourceName, ValidatorBuilder::NAME); $storageName = DefinitionHelper::getServiceName($this->container, $resourceName, StorageBuilder::NAME); $voName = $packageConfiguration[Definition::OBJECT_NAME]; $class = DefinitionHelper::getClassImplementation($this->container, $resourceName, static::NAME, static::BASE_CLASS); $configuration = array('class' => $class, 'singleton' => 'true', 'call' => array('setValidator' => array('@' . $validatorName), 'setStorage' => array('@' . $storageName), 'setVOFQCN' => array($voName))); return $configuration; }
public function build($resourceName) { $packageConfiguration = $this->container->getParameter(implode('.', array(Definition::PARAM_PACKAGES, $resourceName))); $serviceName = DefinitionHelper::getServiceName($this->container, $resourceName, $this->getDefinitionName()); if (!self::containerHasPackage($serviceName)) { return array($serviceName, $this->makeConfiguration($packageConfiguration, $resourceName)); } return array($serviceName, null); }