public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);
        $this->globalConfig = $config;

        $container->setParameter('sidus_eav_model.entity.data.class', $config['data_class']);
        $container->setParameter('sidus_eav_model.entity.value.class', $config['value_class']);
        $container->setParameter('sidus_eav_model.form.collection_type', $config['collection_type']);
        $container->setParameter('sidus_eav_model.context.form_type', $config['context_form_type']);
        $container->setParameter('sidus_eav_model.context.default_context', $config['default_context']);
        $container->setParameter('sidus_eav_model.context.global_mask', $config['global_context_mask']);

        // Injecting custom doctrine type
        $doctrineTypes = $container->getParameter('doctrine.dbal.connection_factory.types');
        $doctrineTypes['sidus_family'] = ['class' => FamilyType::class, 'commented' => true];
        $container->setParameter('doctrine.dbal.connection_factory.types', $doctrineTypes);

        // Load services config
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/services'));
        $loader->load('attribute_types.yml');
        $loader->load('configuration.yml');
        $loader->load('context.yml');
        $loader->load('debug.yml');
        $loader->load('deprecated.yml');
        $loader->load('doctrine.yml');
        $loader->load('entities.yml');
        $loader->load('events.yml');
        $loader->load('forms.yml');
        $loader->load('manager.yml');
        $loader->load('param_converters.yml');
        $loader->load('twig.yml');
        $loader->load('validators.yml');

        if ($config['serializer_enabled']) {
            // Only load normalizers if symfony serializer is loaded
            $loader->load('serializer.yml');
            $loader->load('normalizer.yml');
            $loader->load('denormalizer.yml');
            $loader->load('deprecated_serializer.yml');
        }

        // The DatagridBundle might be installed
        /** @noinspection PhpUndefinedClassInspection */
        if (interface_exists(RenderableInterface::class)) {
            $loader->load('datagrid.yml');
        }
        /** @noinspection PhpUndefinedClassInspection */
        if (interface_exists(ColumnValueRendererInterface::class)) {
            $loader->load('datagrid-v2.yml');
        }

        // Add global attribute configuration to handler
        $attributeConfiguration = $container->getDefinition(AttributeRegistry::class);
        $attributeConfiguration->addMethodCall('parseGlobalConfig', [$config['attributes']]);

        $this->createFamilyServices($config, $container);
    }
public function load(array $configs, ContainerBuilder $container)
    {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);
        $this->globalConfig = $config;

        $container->setParameter('sidus_eav_model.entity.data.class', $config['data_class']);
        $container->setParameter('sidus_eav_model.entity.value.class', $config['value_class']);
        $container->setParameter('sidus_eav_model.form.collection_type', $config['collection_type']);
        $container->setParameter('sidus_eav_model.context.form_type', $config['context_form_type']);
        $container->setParameter('sidus_eav_model.context.default_context', $config['default_context']);
        $container->setParameter('sidus_eav_model.context.global_mask', $config['global_context_mask']);

        // Injecting custom doctrine type
        $doctrineTypes = $container->getParameter('doctrine.dbal.connection_factory.types');
        $doctrineTypes['sidus_family'] = ['class' => FamilyType::class, 'commented' => true];
        $container->setParameter('doctrine.dbal.connection_factory.types', $doctrineTypes);

        // Load services config
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/services'));
        $loader->load('attribute_types.yml');
        $loader->load('configuration.yml');
        $loader->load('context.yml');
        $loader->load('debug.yml');
        $loader->load('deprecated.yml');
        $loader->load('doctrine.yml');
        $loader->load('entities.yml');
        $loader->load('events.yml');
        $loader->load('forms.yml');
        $loader->load('manager.yml');
        $loader->load('param_converters.yml');
        $loader->load('twig.yml');
        $loader->load('validators.yml');

        if ($config['serializer_enabled']) {
            // Only load normalizers if symfony serializer is loaded
            $loader->load('serializer.yml');
            $loader->load('normalizer.yml');
            $loader->load('denormalizer.yml');
            $loader->load('deprecated_serializer.yml');
        }

        // The DatagridBundle might be installed
        /** @noinspection PhpUndefinedClassInspection */
        if (interface_exists(RenderableInterface::class)) {
            $loader->load('datagrid.yml');
        }
        /** @noinspection PhpUndefinedClassInspection */
        if (interface_exists(ColumnValueRendererInterface::class)) {
            $loader->load('datagrid-v2.yml');
        }

        // Add global attribute configuration to handler
        $attributeConfiguration = $container->getDefinition(AttributeRegistry::class);
        $attributeConfiguration->addMethodCall('parseGlobalConfig', [$config['attributes']]);

        $this->createFamilyServices($config, $container);
    }
public function load ( array $ configs , ContainerBuilder $ container ) { $ configuration = new Configuration ( ) ; $ config = $ this -> processConfiguration ( $ configuration , $ configs ) ; $ this -> globalConfig = $ config ; $ container -> setParameter ( 'sidus_eav_model.entity.data.class' , $ config [ 'data_class' ] ) ; $ container -> setParameter ( 'sidus_eav_model.entity.value.class' , $ config [ 'value_class' ] ) ; $ container -> setParameter ( 'sidus_eav_model.form.collection_type' , $ config [ 'collection_type' ] ) ; $ container -> setParameter ( 'sidus_eav_model.context.form_type' , $ config [ 'context_form_type' ] ) ; $ container -> setParameter ( 'sidus_eav_model.context.default_context' , $ config [ 'default_context' ] ) ; $ container -> setParameter ( 'sidus_eav_model.context.global_mask' , $ config [ 'global_context_mask' ] ) ; // Injecting custom doctrine type $ doctrineTypes = $ container -> getParameter ( 'doctrine.dbal.connection_factory.types' ) ; $ doctrineTypes [ 'sidus_family' ] = [ 'class' => FamilyType :: class , 'commented' => true ] ; $ container -> setParameter ( 'doctrine.dbal.connection_factory.types' , $ doctrineTypes ) ; // Load services config $ loader = new Loader \ YamlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config/services' ) ) ; $ loader -> load ( 'attribute_types.yml' ) ; $ loader -> load ( 'configuration.yml' ) ; $ loader -> load ( 'context.yml' ) ; $ loader -> load ( 'debug.yml' ) ; $ loader -> load ( 'deprecated.yml' ) ; $ loader -> load ( 'doctrine.yml' ) ; $ loader -> load ( 'entities.yml' ) ; $ loader -> load ( 'events.yml' ) ; $ loader -> load ( 'forms.yml' ) ; $ loader -> load ( 'manager.yml' ) ; $ loader -> load ( 'param_converters.yml' ) ; $ loader -> load ( 'twig.yml' ) ; $ loader -> load ( 'validators.yml' ) ; if ( $ config [ 'serializer_enabled' ] ) { // Only load normalizers if symfony serializer is loaded $ loader -> load ( 'serializer.yml' ) ; $ loader -> load ( 'normalizer.yml' ) ; $ loader -> load ( 'denormalizer.yml' ) ; $ loader -> load ( 'deprecated_serializer.yml' ) ; } // The DatagridBundle might be installed /** @noinspection PhpUndefinedClassInspection */ if ( interface_exists ( RenderableInterface :: class ) ) { $ loader -> load ( 'datagrid.yml' ) ; } /** @noinspection PhpUndefinedClassInspection */ if ( interface_exists ( ColumnValueRendererInterface :: class ) ) { $ loader -> load ( 'datagrid-v2.yml' ) ; } // Add global attribute configuration to handler $ attributeConfiguration = $ container -> getDefinition ( AttributeRegistry :: class ) ; $ attributeConfiguration -> addMethodCall ( 'parseGlobalConfig' , [ $ config [ 'attributes' ] ] ) ; $ this -> createFamilyServices ( $ config , $ container ) ; }
Generate automatically services for attributes and families from configuration

@param array            $configs
@param ContainerBuilder $container

@throws \Exception
Generate automatically services for attributes and families from configuration