mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-07 09:26:12 +00:00
Add configuration for ChillTicketBundle parameters: add an option to set one / multi Person entities per ticket
This commit is contained in:
parent
c8e5d0eb37
commit
2b22d4cb7c
4
config/packages/chill_ticket.yaml
Normal file
4
config/packages/chill_ticket.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
chill_ticket:
|
||||
ticket:
|
||||
person_per_ticket: one # One of "one"; "many"
|
||||
|
@ -24,6 +24,11 @@ class ChillTicketExtension extends Extension implements PrependExtensionInterfac
|
||||
{
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
|
||||
$container->setParameter('chill_ticket', $config);
|
||||
|
||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../config'));
|
||||
$loader->load('services.yaml');
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Chill\TicketBundle\DependencyInjection;
|
||||
|
||||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
public function getConfigTreeBuilder(): TreeBuilder
|
||||
{
|
||||
$treeBuilder = new TreeBuilder('chill_ticket');
|
||||
/** @var ArrayNodeDefinition $rootNode */
|
||||
$rootNode = $treeBuilder->getRootNode();
|
||||
|
||||
/** @var ArrayNodeDefinition $ticketArray */
|
||||
$ticketArray = $rootNode
|
||||
->children()
|
||||
->arrayNode('ticket')
|
||||
->addDefaultsIfNotSet()
|
||||
;
|
||||
|
||||
$ticketArray
|
||||
->children()
|
||||
->enumNode('person_per_ticket')
|
||||
->values(['one', 'many'])
|
||||
->defaultValue('many')
|
||||
->end();
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user