mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +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])
|
||||
@ -98,8 +101,9 @@ class ExportType extends AbstractType
|
||||
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])
|
||||
|
@ -36,22 +36,17 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
|
||||
*/
|
||||
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(
|
||||
@ -74,6 +69,7 @@ class FilterType extends AbstractType
|
||||
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