Completed
Push — master ( a33308...36ba79 )
by Maximilian
01:58
created

src/Form/Type/Filter/ChoiceType.php (4 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of the Sonata Project package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Sonata\DoctrinePHPCRAdminBundle\Form\Type\Filter;
13
14
use Sonata\AdminBundle\Form\Type\Filter\ChoiceType as BaseChoiceType;
15
use Symfony\Component\Form\FormBuilderInterface;
16
17
class ChoiceType extends BaseChoiceType
18
{
19
    const TYPE_CONTAINS_WORDS = 4;
20
21
    /**
22
     * {@inheritdoc}
23
     *
24
     * @todo Remove when Symfony <2.8 is no longer supported
25
     */
26
    public function getName()
27
    {
28
        return $this->getBlockPrefix();
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function getBlockPrefix()
35
    {
36
        return 'doctrine_phpcr_type_filter_choice';
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function buildForm(FormBuilderInterface $builder, array $options)
43
    {
44
        $choices = array(
45
            self::TYPE_CONTAINS => $this->translator->trans('label_type_contains', array(), 'SonataAdminBundle'),
0 ignored issues
show
Deprecated Code introduced by
The property Sonata\AdminBundle\Form\...ChoiceType::$translator has been deprecated with message: since 3.5, to be removed with 4.0

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
46
            self::TYPE_NOT_CONTAINS => $this->translator->trans('label_type_not_contains', array(), 'SonataAdminBundle'),
0 ignored issues
show
Deprecated Code introduced by
The property Sonata\AdminBundle\Form\...ChoiceType::$translator has been deprecated with message: since 3.5, to be removed with 4.0

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
47
            self::TYPE_EQUAL => $this->translator->trans('label_type_equals', array(), 'SonataAdminBundle'),
0 ignored issues
show
Deprecated Code introduced by
The property Sonata\AdminBundle\Form\...ChoiceType::$translator has been deprecated with message: since 3.5, to be removed with 4.0

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
48
            self::TYPE_CONTAINS_WORDS => $this->translator->trans('label_type_contains_words', array(), 'SonataDoctrinePHPCRAdmin'),
0 ignored issues
show
Deprecated Code introduced by
The property Sonata\AdminBundle\Form\...ChoiceType::$translator has been deprecated with message: since 3.5, to be removed with 4.0

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
49
        );
50
51
        $builder
52
            ->add('type', 'choice', array('choices' => $choices, 'required' => false))
53
            ->add('value', $options['field_type'], array_merge(array('required' => false), $options['field_options']))
54
        ;
55
    }
56
}
57