| Conditions | 5 | 
| Paths | 5 | 
| Total Lines | 25 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 1 | 
| 1 | <?php | ||
| 20 | public function process(ContainerBuilder $container) | ||
| 21 |     { | ||
| 22 |         $entityCollectionType = $container->getDefinition('majora.loader.bridge.form.type.entity_collection'); | ||
| 23 |         $loaders = $container->findTaggedServiceIds('majora.loader_bridge.form'); | ||
| 24 | |||
| 25 |         foreach ($loaders as $loaderId => $tags) { | ||
| 26 | $loaderDefinition = $container->getDefinition($loaderId); | ||
| 27 | $loaderReflection = new \ReflectionClass($loaderDefinition->getClass()); | ||
| 28 | |||
| 29 |             if (!$loaderReflection->implementsInterface(LoaderBridgeInterface::class)) { | ||
| 30 |                 throw new \RuntimeException(sprintf('The loader "%s" have to implement "%s" because it is tagged as "majora.loader_bridge.form".', $loaderDefinition->getClass(), LoaderBridgeInterface::class)); | ||
| 31 | } | ||
| 32 | |||
| 33 |             foreach ($tags as $attributes) { | ||
| 34 |                 if (!isset($attributes['alias'])) { | ||
| 35 |                     throw new \RuntimeException('Alias required for "majora.loader_bridge.form" tag.'); | ||
| 36 | } | ||
| 37 | |||
| 38 | $entityCollectionType->addMethodCall( | ||
| 39 | 'registerLoader', | ||
| 40 | array($attributes['alias'], new Reference($loaderId)) | ||
| 41 | ); | ||
| 42 | } | ||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||
| 46 |