<?php/** * CoreShop. * * This source file is subject to the GNU General Public License version 3 (GPLv3) * For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt * files that are distributed with this source code. * * @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org) * @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3) */namespace CoreShop\Bundle\RuleBundle\DependencyInjection;use CoreShop\Bundle\ResourceBundle\Controller\ResourceController;use CoreShop\Bundle\ResourceBundle\CoreShopResourceBundle;use CoreShop\Component\Resource\Factory\Factory;use CoreShop\Component\Rule\Model\Action;use CoreShop\Component\Rule\Model\ActionInterface;use CoreShop\Component\Rule\Model\Condition;use CoreShop\Component\Rule\Model\ConditionInterface;use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;use Symfony\Component\Config\Definition\Builder\TreeBuilder;use Symfony\Component\Config\Definition\ConfigurationInterface;final class Configuration implements ConfigurationInterface{ /** * {@inheritdoc} */ public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('core_shop_rule'); $rootNode ->children() ->scalarNode('driver')->defaultValue(CoreShopResourceBundle::DRIVER_DOCTRINE_ORM)->end() ->end(); $this->addModelsSection($rootNode); $this->addPimcoreResourcesSection($rootNode); return $treeBuilder; } /** * @param ArrayNodeDefinition $node */ private function addModelsSection(ArrayNodeDefinition $node) { $node ->children() ->arrayNode('resources') ->addDefaultsIfNotSet() ->children() ->arrayNode('rule_condition') ->addDefaultsIfNotSet() ->children() ->variableNode('options')->end() ->arrayNode('classes') ->addDefaultsIfNotSet() ->children() ->scalarNode('model')->defaultValue(Condition::class)->cannotBeEmpty()->end() ->scalarNode('interface')->defaultValue(ConditionInterface::class)->cannotBeEmpty()->end() ->scalarNode('admin_controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() ->scalarNode('repository')->cannotBeEmpty()->end() //->scalarNode('form')->defaultValue(CurrencyType::class)->cannotBeEmpty()->end() ->end() ->end() ->end() ->end() ->arrayNode('rule_action') ->addDefaultsIfNotSet() ->children() ->variableNode('options')->end() ->arrayNode('classes') ->addDefaultsIfNotSet() ->children() ->scalarNode('model')->defaultValue(Action::class)->cannotBeEmpty()->end() ->scalarNode('interface')->defaultValue(ActionInterface::class)->cannotBeEmpty()->end() ->scalarNode('admin_controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() ->scalarNode('factory')->defaultValue(Factory::class)->cannotBeEmpty()->end() ->scalarNode('repository')->cannotBeEmpty()->end() //->scalarNode('form')->defaultValue(CurrencyType::class)->cannotBeEmpty()->end() ->end() ->end() ->end() ->end() ->end() ->end() ->end(); } /** * @param ArrayNodeDefinition $node */ private function addPimcoreResourcesSection(ArrayNodeDefinition $node) { $node->children() ->arrayNode('pimcore_admin') ->addDefaultsIfNotSet() ->children() ->arrayNode('js') ->useAttributeAsKey('name') ->prototype('scalar')->end() ->end() ->arrayNode('css') ->useAttributeAsKey('name') ->prototype('scalar')->end() ->end() ->arrayNode('editmode_js') ->useAttributeAsKey('name') ->prototype('scalar')->end() ->end() ->arrayNode('editmode_css') ->useAttributeAsKey('name') ->prototype('scalar')->end() ->end() ->end() ->end() ->end(); }}