public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yaml');

        $configuration = new Configuration;
        $config = $this->processConfiguration($configuration, $configs);

        $definition = $container->getDefinition(EntityCollection::class);
        $definition->addArgument($config['entities']);

        foreach ($config['permissions'] as $key => $element) {
            $element['key'] = $key;

            if (!array_key_exists('attributes', $element)) {
                $element['attributes'] = [];
            }

            if (!array_key_exists('type', $element)) {
                $element['type'] = null;
            }

            if (!array_key_exists('value', $element)) {
                $element['value'] = null;
            }

            if (!array_key_exists('title', $element)) {
                $element['title'] = null;
            }

            foreach ([Permission::GENERIC, Permission::ENTITY, Permission::PROPERTY] as $type) {
                if (array_key_exists($type, $element)) {
                    $element['type'] = $type;
                    $element['value'] = $element[$type];
                    unset($element[$type]);
                }
            }

            $config['permissions'][$key] = $element;
        }

        $definition = $container->findDefinition(PermissionCollection::class);
        $definition->setArguments([$config['permissions']]);

        if (!$config['enabled']) {
            $container->removeDefinition(EntityExtension::class);
            $container->removeDefinition(EntityListener::class);
            $container->removeDefinition(JsonNormalizer::class);
            $container->removeDefinition(JsonLdNormalizer::class);
        }
    }
public function load(array $configs, ContainerBuilder $container)
    {
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('services.yaml');

        $configuration = new Configuration;
        $config = $this->processConfiguration($configuration, $configs);

        $definition = $container->getDefinition(EntityCollection::class);
        $definition->addArgument($config['entities']);

        foreach ($config['permissions'] as $key => $element) {
            $element['key'] = $key;

            if (!array_key_exists('attributes', $element)) {
                $element['attributes'] = [];
            }

            if (!array_key_exists('type', $element)) {
                $element['type'] = null;
            }

            if (!array_key_exists('value', $element)) {
                $element['value'] = null;
            }

            if (!array_key_exists('title', $element)) {
                $element['title'] = null;
            }

            foreach ([Permission::GENERIC, Permission::ENTITY, Permission::PROPERTY] as $type) {
                if (array_key_exists($type, $element)) {
                    $element['type'] = $type;
                    $element['value'] = $element[$type];
                    unset($element[$type]);
                }
            }

            $config['permissions'][$key] = $element;
        }

        $definition = $container->findDefinition(PermissionCollection::class);
        $definition->setArguments([$config['permissions']]);

        if (!$config['enabled']) {
            $container->removeDefinition(EntityExtension::class);
            $container->removeDefinition(EntityListener::class);
            $container->removeDefinition(JsonNormalizer::class);
            $container->removeDefinition(JsonLdNormalizer::class);
        }
    }
{@inheritdoc}