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) { |
||
50 | $this->setButtonTwigExtension($buttonTwigExtension); |
||
51 | $this->setRouter($router); |
||
52 | $this->setTranslator($translator); |
||
|
|||
53 | } |
||
54 | |||
55 | /** |
||
56 | * {@inheritDoc} |
||
57 | */ |
||
58 | public function getCSVExporter() { |
||
59 | return null; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * {@inheritDoc} |
||
64 | */ |
||
65 | public function getEditor() { |
||
66 | return null; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * {@inheritDoc} |
||
71 | */ |
||
72 | public function getMethod() { |
||
73 | return null; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * {@inheritDoc} |
||
78 | */ |
||
79 | public function getOptions() { |
||
80 | |||
81 | $dtOptions = DataTablesFactory::newOptions(); |
||
82 | $dtOptions->addOption("responsive", true); |
||
83 | $dtOptions->addOption("searchDelay", 1000); |
||
84 | |||
85 | return $dtOptions; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * Render the DataTables buttons. |
||
90 | * |
||
91 | * @param DataTablesEntityInterface $entity The entity. |
||
92 | * @param string $editRoute The edit route. |
||
93 | * @param string $deleteRoute The delete route. |
||
94 | * @param bool $enableDelete Enable delete ? |
||
95 | * @return string Returns the DataTables buttons. |
||
96 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
97 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
98 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
99 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
100 | * @deprecated since 3.4.0 use "WBW\Bundle\JQuery\DataTablesBundle\Provider\AbstractDataTablesProvider::renderRowButtons()" instead |
||
101 | */ |
||
102 | protected function renderButtons($entity, $editRoute, $deleteRoute = null, $enableDelete = true) { |
||
103 | if (null === $deleteRoute && true === $enableDelete) { |
||
104 | $deleteRoute = "wbw_jquery_datatables_delete"; |
||
105 | } |
||
106 | return $this->renderRowButtons($entity, $editRoute, $deleteRoute, null); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * Render a date. |
||
111 | * |
||
112 | * @param DateTime $date The date. |
||
113 | * @param string $format The format. |
||
114 | * @return string Returns the rendered date. |
||
115 | */ |
||
116 | protected function renderDate(DateTime $date = null, $format = "Y-m-d") { |
||
119 | |||
120 | /** |
||
121 | * Render a date/time. |
||
122 | * |
||
123 | * @param DateTime $date The date/time. |
||
124 | * @param string $format The format. |
||
125 | * @return string Returns the rendered date/time. |
||
126 | */ |
||
127 | protected function renderDateTime(DateTime $date = null, $format = DateTimeRenderer::DATETIME_FORMAT) { |
||
130 | |||
131 | /** |
||
132 | * Render a float. |
||
133 | * |
||
134 | * @param float $number The number. |
||
135 | * @param int $decimals The decimals. |
||
136 | * @param string $decPoint The decimal point. |
||
137 | * @param string $thousandsSep The thousands separator. |
||
138 | * @return string Returns the rendered number. |
||
139 | */ |
||
140 | protected function renderFloat($number, $decimals = 2, $decPoint = ".", $thousandsSep = ",") { |
||
146 | |||
147 | /** |
||
148 | * Render the DataTables row buttons. |
||
149 | * |
||
150 | * @param DataTablesEntityInterface $entity The entity. |
||
151 | * @param string|null $editRoute The edit route. |
||
152 | * @param string|null $deleteRoute The delete route. |
||
153 | * @param string|null $showRoute The show route. |
||
154 | * @return string Returns the DataTables row buttons. |
||
155 | * @throws InvalidArgumentException Throws an invalid argument exception if the entity is invalid. |
||
156 | * @throws InvalidParameterException Throws an invalid parameter exception if a parameter is invalid. |
||
157 | * @throws RouteNotFoundException Throws a route not found exception if the route doesn't exist. |
||
158 | * @throws MissingMandatoryParametersException Throws a missing mandatory parameter exception if a mandatory exception is missing. |
||
159 | */ |
||
160 | protected function renderRowButtons($entity, $editRoute = null, $deleteRoute = null, $showRoute = null) { |
||
202 | |||
203 | /** |
||
204 | * Wrap a content. |
||
205 | * |
||
206 | * @param string|null $prefix The prefix |
||
207 | * @param string $content The content. |
||
208 | * @param string|null $suffix The suffix. |
||
209 | * @return string Returns the wrapped content. |
||
210 | */ |
||
211 | protected function wrapContent($prefix, $content, $suffix) { |
||
225 | } |
||
226 |
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: