eZ\Publish\Core\Base\Container\Compiler\FieldTypeNameableCollectionPass::process PHP Метод

process() публичный Метод

public process ( ContainerBuilder $container )
$container Symfony\Component\DependencyInjection\ContainerBuilder
    public function process(ContainerBuilder $container)
    {
        if (!$container->hasDefinition('ezpublish.field_type_collection.factory')) {
            return;
        }
        $fieldTypeCollectionFactoryDef = $container->getDefinition('ezpublish.field_type_nameable_collection.factory');
        $nameableFieldTypes = [];
        // Nameable Field types.
        // Alias attribute is the field type string.
        foreach ($container->findTaggedServiceIds('ezpublish.fieldType.nameable') as $id => $attributes) {
            foreach ($attributes as $attribute) {
                if (!isset($attribute['alias'])) {
                    throw new LogicException('ezpublish.fieldType service tag needs an "alias" attribute to identify the field type. None given.');
                }
                $fieldTypeCollectionFactoryDef->addMethodCall('registerNameableFieldType', array($id, $attribute['alias']));
                $nameableFieldTypes[] = $attribute['alias'];
            }
        }
        // Field types, loop over and detect those that are missing nameable service.
        // Alias attribute is the field type string.
        foreach ($container->findTaggedServiceIds('ezpublish.fieldType') as $id => $attributes) {
            foreach ($attributes as $attribute) {
                if (!isset($attribute['alias'])) {
                    throw new LogicException('ezpublish.fieldType service tag needs an "alias" attribute to identify the field type. None given.');
                }
                if (in_array($attribute['alias'], $nameableFieldTypes)) {
                    continue;
                }
                $fieldTypeCollectionFactoryDef->addMethodCall('registerNonNameableFieldType', array($id, $attribute['alias']));
            }
        }
    }
FieldTypeNameableCollectionPass