Beispiel #1
0
 /**
  * {@inheritDoc}
  */
 public function getStrategy($contextName, $object)
 {
     // prefix.context_name
     $contextServiceId = $this->converter->getServiceNamespace($this->servicePrefix, $contextName);
     // get the correct strategy service by the object
     $strategy = $this->container->get($contextServiceId);
     $strategy = $strategy->getStrategyName($object);
     // get service namespace
     $strategyAlias = $this->converter->getServiceNamespace($this->servicePrefix, array($contextName, $strategy));
     if (!$this->container->has($strategyAlias)) {
         $strategyAlias = $this->container->get($contextServiceId)->getFallbackStrategy();
     }
     return $this->container->get($strategyAlias);
 }
 public function testGetServiceNamespaceWithConvertedServices()
 {
     $converter = new ServiceNameConverter();
     $input = array('abCd', 'dEf');
     $prefix = 'prefix';
     $this->assertEquals('prefix.ab_cd.d_ef', $converter->getServiceNamespace($prefix, $input));
 }