Common & useful classes, resources, extensions. Based on Symfony framework.
Configuration parameters are loaded by Meritoo\CommonBundle\DependencyInjection\Configuration
class that
implements Symfony\Component\Config\Definition\ConfigurationInterface
and
uses Symfony\Component\Config\Definition\Builder\TreeBuilder
to build structure of configuration parameters.
If the Dependency Injection extension class extends Meritoo\CommonBundle\DependencyInjection\Base\BaseExtension
class,
each parameter is automatically loaded into container with name based on nodes from structure of configuration separated
by .
.
// A piece of getConfigTreeBuilder() method from Configuration class
$rootNode = $treeBuilder->root('my_main_node');
$rootNode
->addDefaultsIfNotSet()
->children()
->arrayNode('lorem')
->addDefaultsIfNotSet()
->children()
->scalarNode('ipsum')
->defaultValue(1234)
->cannotBeEmpty()
->end()
->end()
->end()
->scalarNode('dolor')
->defaultValue('')
->end()
->scalarNode('sit')
->end()
->end()
;
# Parameters loaded into container (with values based on defaults)
my_main_node.lorem.ipsum # Value: 1234
my_main_node.dolor # Value: ""
my_main_node.sit # Value: null
- Configuration
- Dependency Injection Extension
- Descriptor of application
- Descriptor of bundle
- Descriptors of bundles
- Services:
- Tests
- Translations
- Twig extensions: