1 | <?php |
||
36 | abstract class AbstractDataTablesProvider implements DataTablesProviderInterface { |
||
37 | |||
38 | use ButtonTwigExtensionTrait; |
||
39 | use RouterTrait; |
||
40 | use TranslatorTrait; |
||
41 | |||
42 | /** |
||
43 | * Constructor. |
||
44 | * |
||
45 | * @param RouterInterface $router The router. |
||
46 | * @param TranslatorInterface $translator The translator. |
||
47 | * @param ButtonTwigExtension $buttonTwigExtension The button Twig extension. |
||
48 | */ |
||
49 | public function __construct(RouterInterface $router, TranslatorInterface $translator, ButtonTwigExtension $buttonTwigExtension) { |
||
54 | |||
55 | /** |
||
56 | * {@inheritDoc} |
||
57 | */ |
||
58 | public function getCSVExporter() { |
||
61 | |||
62 | /** |
||
63 | * {@inheritDoc} |
||
64 | */ |
||
65 | public function getEditor() { |
||
68 | |||
69 | /** |
||
70 | * {@inheritDoc} |
||
71 | */ |
||
72 | public function getMethod() { |
||
75 | |||
76 | /** |
||
77 | * {@inheritDoc} |
||
78 | */ |
||
79 | public function getOptions() { |
||
87 | |||
88 | /** |
||
89 | * Render an action button "delete". |
||
90 | * |
||
91 | * @param DataTablesEntityInterface $entity The entity. |
||
92 | * @param string $route The route. |
||
93 | * @return string Returns the action button "delete". |
||
94 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
95 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
96 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
97 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
98 | */ |
||
99 | protected function renderActionButtonDelete($entity, $route) { |
||
113 | |||
114 | /** |
||
115 | * Render an action button "duplicate". |
||
116 | * |
||
117 | * @param DataTablesEntityInterface $entity The entity. |
||
118 | * @param string $route The route. |
||
119 | * @return string Returns the action button "duplicate". |
||
120 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
121 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
122 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
123 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
124 | */ |
||
125 | protected function renderActionButtonDuplicate($entity, $route) { |
||
137 | |||
138 | /** |
||
139 | * Render an action button "edit". |
||
140 | * |
||
141 | * @param DataTablesEntityInterface $entity The entity. |
||
142 | * @param string $route The route. |
||
143 | * @return string Returns the action button "edit". |
||
144 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
145 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
146 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
147 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
148 | */ |
||
149 | protected function renderActionButtonEdit($entity, $route) { |
||
161 | |||
162 | /** |
||
163 | * Render an action button "show". |
||
164 | * |
||
165 | * @param DataTablesEntityInterface $entity The entity. |
||
166 | * @param string $route The route. |
||
167 | * @return string Returns the action button "show". |
||
168 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
169 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
170 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
171 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
172 | */ |
||
173 | protected function renderActionButtonShow($entity, $route) { |
||
185 | |||
186 | /** |
||
187 | * Render the DataTables buttons. |
||
188 | * |
||
189 | * @param DataTablesEntityInterface $entity The entity. |
||
190 | * @param string $editRoute The edit route. |
||
191 | * @param string $deleteRoute The delete route. |
||
192 | * @param bool $enableDelete Enable delete ? |
||
193 | * @return string Returns the DataTables buttons. |
||
194 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
195 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
196 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
197 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
198 | * @deprecated since 3.4.0 use "WBW\Bundle\JQuery\DataTablesBundle\Provider\AbstractDataTablesProvider::renderRowButtons()" instead |
||
199 | */ |
||
200 | protected function renderButtons($entity, $editRoute, $deleteRoute = null, $enableDelete = true) { |
||
206 | |||
207 | /** |
||
208 | * Render a date. |
||
209 | * |
||
210 | * @param DateTime $date The date. |
||
211 | * @param string $format The format. |
||
212 | * @return string Returns the rendered date. |
||
213 | */ |
||
214 | protected function renderDate(DateTime $date = null, $format = "Y-m-d") { |
||
217 | |||
218 | /** |
||
219 | * Render a date/time. |
||
220 | * |
||
221 | * @param DateTime $date The date/time. |
||
222 | * @param string $format The format. |
||
223 | * @return string Returns the rendered date/time. |
||
224 | */ |
||
225 | protected function renderDateTime(DateTime $date = null, $format = DateTimeRenderer::DATETIME_FORMAT) { |
||
228 | |||
229 | /** |
||
230 | * Render a float. |
||
231 | * |
||
232 | * @param float $number The number. |
||
233 | * @param int $decimals The decimals. |
||
234 | * @param string $decPoint The decimal point. |
||
235 | * @param string $thousandsSep The thousands separator. |
||
236 | * @return string Returns the rendered number. |
||
237 | */ |
||
238 | protected function renderFloat($number, $decimals = 2, $decPoint = ".", $thousandsSep = ",") { |
||
244 | |||
245 | /** |
||
246 | * Render the DataTables row buttons. |
||
247 | * |
||
248 | * @param DataTablesEntityInterface $entity The entity. |
||
249 | * @param string|null $editRoute The edit route. |
||
250 | * @param string|null $deleteRoute The delete route. |
||
251 | * @param string|null $showRoute The show route. |
||
252 | * @return string Returns the DataTables row buttons. |
||
253 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
254 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
255 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
256 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
257 | */ |
||
258 | protected function renderRowButtons($entity, $editRoute = null, $deleteRoute = null, $showRoute = null) { |
||
276 | |||
277 | /** |
||
278 | * Wrap a content. |
||
279 | * |
||
280 | * @param string|null $prefix The prefix |
||
281 | * @param string $content The content. |
||
282 | * @param string|null $suffix The suffix. |
||
283 | * @return string Returns the wrapped content. |
||
284 | */ |
||
285 | protected function wrapContent($prefix, $content, $suffix) { |
||
299 | } |
||
300 |
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: