mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix deprecations: use fqcn and pass arguments of class as options
This commit is contained in:
parent
7119de8223
commit
0287da70d7
@ -34,20 +34,15 @@ use Chill\MainBundle\Export\ExportManager;
|
||||
*/
|
||||
class AggregatorType extends AbstractType
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \ExportManager
|
||||
*/
|
||||
private $exportManager;
|
||||
|
||||
public function __construct(ExportManager $exportManager)
|
||||
public function __construct()
|
||||
{
|
||||
$this->exportManager = $exportManager;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$aggregator = $this->exportManager->getAggregator($options['aggregator_alias']);
|
||||
$exportManager = $options['export_manager'];
|
||||
$aggregator = $exportManager->getAggregator($options['aggregator_alias']);
|
||||
|
||||
$builder
|
||||
->add('enabled', CheckboxType::class, array(
|
||||
@ -70,6 +65,7 @@ class AggregatorType extends AbstractType
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setRequired('aggregator_alias')
|
||||
->setRequired('export_manager')
|
||||
->setDefault('compound', true)
|
||||
->setDefault('error_bubbling', false)
|
||||
;
|
||||
|
@ -79,9 +79,12 @@ class ExportType extends AbstractType
|
||||
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
||||
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, array('compound' => true));
|
||||
|
||||
dump($this->exportManager);
|
||||
|
||||
foreach($filters as $alias => $filter) {
|
||||
$filterBuilder->add($alias, new FilterType($this->exportManager), array(
|
||||
$filterBuilder->add($alias, FilterType::class, array(
|
||||
'filter_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
'label' => $filter->getTitle(),
|
||||
'constraints' => array(
|
||||
new ExportElementConstraint(['element' => $filter])
|
||||
@ -94,12 +97,13 @@ class ExportType extends AbstractType
|
||||
//add aggregators
|
||||
$aggregators = $this->exportManager
|
||||
->getAggregatorsApplyingOn($export, $options['picked_centers']);
|
||||
$aggregatorBuilder = $builder->create(self::AGGREGATOR_KEY, FormType::class,
|
||||
$aggregatorBuilder = $builder->create(self::AGGREGATOR_KEY, FormType::class,
|
||||
array('compound' => true));
|
||||
|
||||
foreach($aggregators as $alias => $aggregator) {
|
||||
$aggregatorBuilder->add($alias, new AggregatorType($this->exportManager), array(
|
||||
$aggregatorBuilder->add($alias, AggregatorType::class, array(
|
||||
'aggregator_alias' => $alias,
|
||||
'export_manager' => $this->exportManager,
|
||||
'label' => $aggregator->getTitle(),
|
||||
'constraints' => array(
|
||||
new ExportElementConstraint(['element' => $aggregator])
|
||||
|
@ -30,53 +30,49 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
|
||||
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class FilterType extends AbstractType
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var \ExportManager
|
||||
*/
|
||||
private $exportManager;
|
||||
|
||||
const ENABLED_FIELD = 'enabled';
|
||||
|
||||
public function __construct(ExportManager $exportManager)
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->exportManager = $exportManager;
|
||||
}
|
||||
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$filter = $this->exportManager->getFilter($options['filter_alias']);
|
||||
|
||||
|
||||
$exportManager = $options['export_manager'];
|
||||
$filter = $exportManager->getFilter($options['filter_alias']);
|
||||
|
||||
$builder
|
||||
->add(self::ENABLED_FIELD, CheckboxType::class, array(
|
||||
'value' => true,
|
||||
'data' => false,
|
||||
'required' => false
|
||||
));
|
||||
|
||||
|
||||
$filterFormBuilder = $builder->create('form', FormType::class, array(
|
||||
'compound' => true,
|
||||
'compound' => true,
|
||||
'error_bubbling' => false,
|
||||
'required' => false,
|
||||
));
|
||||
$filter->buildForm($filterFormBuilder);
|
||||
|
||||
|
||||
$builder->add($filterFormBuilder);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setRequired('filter_alias')
|
||||
->setRequired('export_manager')
|
||||
->setDefault('compound', true)
|
||||
->setDefault('error_bubbling', false)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user