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; |
||
13 | |||
14 | use Symfony\Component\Form\AbstractType; |
||
15 | use Symfony\Component\Form\FormInterface; |
||
16 | use Symfony\Component\Form\FormView; |
||
17 | use Symfony\Component\OptionsResolver\OptionsResolver; |
||
18 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
||
19 | |||
20 | class TreeManagerType extends AbstractType |
||
21 | { |
||
22 | /** |
||
23 | * {@inheritdoc} |
||
24 | */ |
||
25 | public function buildView(FormView $view, FormInterface $form, array $options) |
||
26 | { |
||
27 | $view->vars['root'] = $options['root']; |
||
28 | //$view->vars['create_in_overlay'] = $options['create_in_overlay']; |
||
29 | //$view->vars['edit_in_overlay'] = $options['edit_in_overlay']; |
||
30 | //$view->vars['delete_in_overlay'] = $options['delete_in_overlay']; |
||
31 | parent::buildView($view, $form, $options); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | * |
||
37 | * @todo Remove when Symfony <2.8 is no longer supported |
||
38 | */ |
||
39 | public function setDefaultOptions(OptionsResolverInterface $resolver) |
||
40 | { |
||
41 | $this->configureOptions($resolver); |
||
0 ignored issues
–
show
|
|||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | public function configureOptions(OptionsResolver $resolver) |
||
48 | { |
||
49 | $resolver->setRequired(array('root')); |
||
50 | |||
51 | if (method_exists($resolver, 'setDefined')) { |
||
52 | // The new OptionsResolver API |
||
53 | $resolver->setDefined(array('create_in_overlay', 'edit_in_overlay', 'delete_in_overlay')); |
||
54 | } else { |
||
55 | // To keep compatibility with old Symfony <2.6 API |
||
56 | $resolver->setOptional(array('create_in_overlay', 'edit_in_overlay', 'delete_in_overlay')); |
||
0 ignored issues
–
show
The method
setOptional() does not seem to exist on object<Symfony\Component...solver\OptionsResolver> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||
57 | } |
||
58 | |||
59 | $resolver->setDefaults(array( |
||
60 | 'create_in_overlay' => true, |
||
61 | 'edit_in_overlay' => true, |
||
62 | 'delete_in_overlay' => true, |
||
63 | )); |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | * |
||
69 | * @todo Remove when Symfony <2.8 is no longer supported |
||
70 | */ |
||
71 | public function getName() |
||
72 | { |
||
73 | return $this->getBlockPrefix(); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function getBlockPrefix() |
||
80 | { |
||
81 | return 'doctrine_phpcr_odm_tree_manager'; |
||
82 | } |
||
83 | } |
||
84 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: