These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\AdminList; |
||
4 | |||
5 | use Doctrine\ORM\EntityManager; |
||
6 | use Doctrine\ORM\QueryBuilder; |
||
7 | use Kunstmaan\AdminBundle\Entity\EntityInterface; |
||
8 | use Kunstmaan\AdminBundle\Helper\Security\Acl\AclHelper; |
||
9 | use Kunstmaan\AdminBundle\Helper\Security\Acl\Permission\PermissionDefinition; |
||
10 | use Kunstmaan\AdminListBundle\AdminList\Configurator\AbstractDoctrineORMAdminListConfigurator; |
||
11 | use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\BooleanFilterType; |
||
12 | use Kunstmaan\AdminListBundle\AdminList\FilterType\ORM\StringFilterType; |
||
13 | |||
14 | /** |
||
15 | * Adminlist configuration to list all the form pages |
||
16 | */ |
||
17 | class FormPageAdminListConfigurator extends AbstractDoctrineORMAdminListConfigurator |
||
18 | { |
||
19 | /** |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $permission; |
||
23 | |||
24 | /** |
||
25 | * @param EntityManager $em The entity manager |
||
26 | * @param AclHelper $aclHelper The ACL helper |
||
27 | * @param string $permission The permission |
||
28 | */ |
||
29 | public function __construct(EntityManager $em, AclHelper $aclHelper, $permission) |
||
30 | { |
||
31 | parent::__construct($em, $aclHelper); |
||
32 | $this->setPermissionDefinition( |
||
33 | new PermissionDefinition(array($permission), 'Kunstmaan\NodeBundle\Entity\Node', 'n') |
||
34 | ); |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Configure filters |
||
39 | */ |
||
40 | public function buildFilters() |
||
41 | { |
||
42 | $builder = $this->getFilterBuilder(); |
||
43 | $builder->add('title', new StringFilterType('title'), 'kuma_form.list.filter.title') |
||
44 | ->add('online', new BooleanFilterType('online'), 'kuma_form.list.filter.online'); |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * Configure the visible columns |
||
49 | */ |
||
50 | public function buildFields() |
||
51 | { |
||
52 | $this->addField('title', 'kuma_form.list.header.title', true) |
||
0 ignored issues
–
show
|
|||
53 | ->addField('lang', 'kuma_form.list.header.language', true) |
||
0 ignored issues
–
show
true is of type boolean , but the function expects a string .
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: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
54 | ->addField('url', 'kuma_form.list.header.path', true); |
||
0 ignored issues
–
show
true is of type boolean , but the function expects a string .
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: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
55 | } |
||
56 | |||
57 | /** |
||
58 | * Add a view action. |
||
59 | */ |
||
60 | public function buildItemActions() |
||
61 | { |
||
62 | $create_route = function (EntityInterface $item) { |
||
63 | return array( |
||
64 | 'path' => 'KunstmaanFormBundle_formsubmissions_list', |
||
65 | 'params' => array('nodeTranslationId' => $item->getId()), |
||
66 | ); |
||
67 | }; |
||
68 | $ia = new \Kunstmaan\AdminListBundle\AdminList\ItemAction\SimpleItemAction( |
||
69 | $create_route, |
||
70 | 'eye', |
||
71 | 'View' |
||
72 | ); |
||
73 | $this->addItemAction($ia); |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Return the url to edit the given $item |
||
78 | * |
||
79 | * @param mixed $item |
||
80 | * |
||
81 | * @return array |
||
82 | */ |
||
83 | public function getEditUrlFor($item) |
||
84 | { |
||
85 | return array( |
||
86 | 'path' => 'KunstmaanFormBundle_formsubmissions_list', |
||
87 | 'params' => array('nodeTranslationId' => $item->getId()), |
||
88 | ); |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Return the url to list all the items |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | public function getIndexUrl() |
||
97 | { |
||
98 | return array('path' => 'KunstmaanFormBundle_formsubmissions'); |
||
99 | } |
||
100 | |||
101 | /** |
||
102 | * Configure if it's possible to add new items |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function canAdd() |
||
107 | { |
||
108 | return false; |
||
109 | } |
||
110 | |||
111 | public function canEdit($item) |
||
112 | { |
||
113 | return false; |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * Configure the types of items you can add |
||
118 | * |
||
119 | * @param array $params |
||
120 | * |
||
121 | * @return array |
||
122 | */ |
||
123 | public function getAddUrlFor(array $params = array()) |
||
124 | { |
||
125 | return ''; |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * Configure if it's possible to delete the given $item |
||
130 | * |
||
131 | * @param mixed $item |
||
132 | * |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function canDelete($item) |
||
136 | { |
||
137 | return false; |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * Get the delete url for the given $item |
||
142 | * |
||
143 | * @param mixed $item |
||
144 | * |
||
145 | * @return array |
||
146 | */ |
||
147 | public function getDeleteUrlFor($item) |
||
148 | { |
||
149 | return array(); |
||
150 | } |
||
151 | |||
152 | /** |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getBundleName() |
||
156 | { |
||
157 | return 'KunstmaanNodeBundle'; |
||
158 | } |
||
159 | |||
160 | /** |
||
161 | * @return string |
||
162 | */ |
||
163 | public function getEntityName() |
||
164 | { |
||
165 | return 'NodeTranslation'; |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * Override controller path (because actions for different entities are defined in a single Settings controller). |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | public function getControllerPath() |
||
174 | { |
||
175 | return 'KunstmaanFormBundle:FormSubmissions'; |
||
176 | } |
||
177 | |||
178 | /** |
||
179 | * @param QueryBuilder $queryBuilder The query builder |
||
180 | */ |
||
181 | public function adaptQueryBuilder(QueryBuilder $queryBuilder) |
||
182 | { |
||
183 | parent::adaptQueryBuilder($queryBuilder); |
||
184 | $queryBuilder->innerJoin('b.node', 'n', 'WITH', 'b.node = n.id') |
||
185 | ->andWhere( |
||
186 | 'n.id IN (SELECT m.id FROM Kunstmaan\FormBundle\Entity\FormSubmission s join s.node m)' |
||
187 | ) |
||
188 | ->addOrderBy('n.id', 'DESC'); |
||
189 | } |
||
190 | } |
||
191 |
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: