1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Sonata Project package. |
7
|
|
|
* |
8
|
|
|
* (c) Thomas Rabaix <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Sonata\DoctrinePHPCRAdminBundle\Form\Type; |
15
|
|
|
|
16
|
|
|
use Symfony\Component\Form\AbstractType; |
17
|
|
|
use Symfony\Component\Form\FormInterface; |
18
|
|
|
use Symfony\Component\Form\FormView; |
19
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver; |
20
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolverInterface; |
21
|
|
|
|
22
|
|
|
class TreeManagerType extends AbstractType |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* {@inheritdoc} |
26
|
|
|
*/ |
27
|
|
|
public function buildView(FormView $view, FormInterface $form, array $options): void |
28
|
|
|
{ |
29
|
|
|
$view->vars['root'] = $options['root']; |
30
|
|
|
//$view->vars['create_in_overlay'] = $options['create_in_overlay']; |
31
|
|
|
//$view->vars['edit_in_overlay'] = $options['edit_in_overlay']; |
32
|
|
|
//$view->vars['delete_in_overlay'] = $options['delete_in_overlay']; |
33
|
|
|
parent::buildView($view, $form, $options); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* NEXT_MAJOR: remove this method. |
38
|
|
|
*/ |
39
|
|
|
public function setDefaultOptions(OptionsResolverInterface $resolver): void |
40
|
|
|
{ |
41
|
|
|
$this->configureOptions($resolver); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* {@inheritdoc} |
46
|
|
|
*/ |
47
|
|
|
public function configureOptions(OptionsResolver $resolver): void |
48
|
|
|
{ |
49
|
|
|
$resolver->setRequired(['root']); |
50
|
|
|
|
51
|
|
|
// The new OptionsResolver API |
52
|
|
|
$resolver->setDefined(['create_in_overlay', 'edit_in_overlay', 'delete_in_overlay']); |
53
|
|
|
|
54
|
|
|
$resolver->setDefaults([ |
55
|
|
|
'create_in_overlay' => true, |
56
|
|
|
'edit_in_overlay' => true, |
57
|
|
|
'delete_in_overlay' => true, |
58
|
|
|
]); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* NEXT_MAJOR: remove this method. |
63
|
|
|
*/ |
64
|
|
|
public function getName() |
65
|
|
|
{ |
66
|
|
|
return $this->getBlockPrefix(); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* {@inheritdoc} |
71
|
|
|
*/ |
72
|
|
|
public function getBlockPrefix() |
73
|
|
|
{ |
74
|
|
|
return 'doctrine_phpcr_odm_tree_manager'; |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|
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: