mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +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
|
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)
|
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
|
$builder
|
||||||
->add('enabled', CheckboxType::class, array(
|
->add('enabled', CheckboxType::class, array(
|
||||||
@ -70,6 +65,7 @@ class AggregatorType extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setRequired('aggregator_alias')
|
$resolver->setRequired('aggregator_alias')
|
||||||
|
->setRequired('export_manager')
|
||||||
->setDefault('compound', true)
|
->setDefault('compound', true)
|
||||||
->setDefault('error_bubbling', false)
|
->setDefault('error_bubbling', false)
|
||||||
;
|
;
|
||||||
|
@ -79,9 +79,12 @@ class ExportType extends AbstractType
|
|||||||
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
$filters = $this->exportManager->getFiltersApplyingOn($export, $options['picked_centers']);
|
||||||
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, array('compound' => true));
|
$filterBuilder = $builder->create(self::FILTER_KEY, FormType::class, array('compound' => true));
|
||||||
|
|
||||||
|
dump($this->exportManager);
|
||||||
|
|
||||||
foreach($filters as $alias => $filter) {
|
foreach($filters as $alias => $filter) {
|
||||||
$filterBuilder->add($alias, new FilterType($this->exportManager), array(
|
$filterBuilder->add($alias, FilterType::class, array(
|
||||||
'filter_alias' => $alias,
|
'filter_alias' => $alias,
|
||||||
|
'export_manager' => $this->exportManager,
|
||||||
'label' => $filter->getTitle(),
|
'label' => $filter->getTitle(),
|
||||||
'constraints' => array(
|
'constraints' => array(
|
||||||
new ExportElementConstraint(['element' => $filter])
|
new ExportElementConstraint(['element' => $filter])
|
||||||
@ -98,8 +101,9 @@ class ExportType extends AbstractType
|
|||||||
array('compound' => true));
|
array('compound' => true));
|
||||||
|
|
||||||
foreach($aggregators as $alias => $aggregator) {
|
foreach($aggregators as $alias => $aggregator) {
|
||||||
$aggregatorBuilder->add($alias, new AggregatorType($this->exportManager), array(
|
$aggregatorBuilder->add($alias, AggregatorType::class, array(
|
||||||
'aggregator_alias' => $alias,
|
'aggregator_alias' => $alias,
|
||||||
|
'export_manager' => $this->exportManager,
|
||||||
'label' => $aggregator->getTitle(),
|
'label' => $aggregator->getTitle(),
|
||||||
'constraints' => array(
|
'constraints' => array(
|
||||||
new ExportElementConstraint(['element' => $aggregator])
|
new ExportElementConstraint(['element' => $aggregator])
|
||||||
|
@ -36,22 +36,17 @@ use Symfony\Component\Form\Extension\Core\Type\FormType;
|
|||||||
*/
|
*/
|
||||||
class FilterType extends AbstractType
|
class FilterType extends AbstractType
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var \ExportManager
|
|
||||||
*/
|
|
||||||
private $exportManager;
|
|
||||||
|
|
||||||
const ENABLED_FIELD = 'enabled';
|
const ENABLED_FIELD = 'enabled';
|
||||||
|
|
||||||
public function __construct(ExportManager $exportManager)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->exportManager = $exportManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
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
|
$builder
|
||||||
->add(self::ENABLED_FIELD, CheckboxType::class, array(
|
->add(self::ENABLED_FIELD, CheckboxType::class, array(
|
||||||
@ -74,6 +69,7 @@ class FilterType extends AbstractType
|
|||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
{
|
{
|
||||||
$resolver->setRequired('filter_alias')
|
$resolver->setRequired('filter_alias')
|
||||||
|
->setRequired('export_manager')
|
||||||
->setDefault('compound', true)
|
->setDefault('compound', true)
|
||||||
->setDefault('error_bubbling', false)
|
->setDefault('error_bubbling', false)
|
||||||
;
|
;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user