1 | <?php |
||
25 | class RestApiController extends FOSRestController |
||
26 | { |
||
27 | /** |
||
28 | * Returns a paginated list of cards. |
||
29 | * |
||
30 | * @ApiDoc( |
||
31 | * section="Public API (RESTful)", |
||
32 | * resource=true, |
||
33 | * statusCodes={ |
||
34 | * 200="Returned when successful", |
||
35 | * 404="Returned when the cards are not found" |
||
36 | * }, |
||
37 | * filters={ |
||
38 | * {"name"="limit", "dataType"="integer", "required"=false, "description"="Max number of cards to return."}, |
||
39 | * {"name"="page", "dataType"="integer", "required"=false, "description"="Page number."}, |
||
40 | * {"name"="query", "dataType"="string", "required"=false, "description"="Limit result by query."}, |
||
41 | * {"name"="category", "dataType"="integer", "required"=false, "description"="Limit result by a category ID."} |
||
42 | * } |
||
43 | * ) |
||
44 | * |
||
45 | * @param Request $request |
||
46 | * |
||
47 | * @return \Symfony\Component\HttpFoundation\Response |
||
48 | */ |
||
49 | public function getCardsAction(Request $request) |
||
85 | |||
86 | /** |
||
87 | * Search for a card. |
||
88 | * |
||
89 | * @ApiDoc( |
||
90 | * section="Public API (RESTful)", |
||
91 | * resource=true, |
||
92 | * statusCodes={ |
||
93 | * 200="Returned when successful", |
||
94 | * 404="Returned when the card is not found" |
||
95 | * }, |
||
96 | * filters={ |
||
97 | * {"name"="query", "dataType"="string", "required"=false, "description"="Search query"}, |
||
98 | * {"name"="pageLink", "dataType"="boolean", "required"=false, "description"="To indicate whether to include a link to the card page (html format only)."}, |
||
99 | * {"name"="shareLink", "dataType"="boolean", "required"=false, "description"="To indicate whether to include the share buttons (twitter & google+) (html format only)."}, |
||
100 | * {"name"="popup", "dataType"="boolean", "required"=false, "description"="To indicate whether to the html is to be displayed as a popup box. This will include 'popup class name and close button' (html format only)."} |
||
101 | * } |
||
102 | * ) |
||
103 | * |
||
104 | * @param Request $request |
||
105 | * |
||
106 | * @return \Symfony\Component\HttpFoundation\Response |
||
107 | */ |
||
108 | public function getCardAction(Request $request) |
||
143 | |||
144 | /** |
||
145 | * Returns a random selection of cards. |
||
146 | * |
||
147 | * @ApiDoc( |
||
148 | * section="Public API (RESTful)", |
||
149 | * resource=true, |
||
150 | * statusCodes={ |
||
151 | * 200="Returned when successful", |
||
152 | * 404="Returned when the cards are not found" |
||
153 | * }, |
||
154 | * filters={ |
||
155 | * {"name"="limit", "dataType"="integer", "required"=false, "description"="Max number of cards to return."} |
||
156 | * } |
||
157 | * ) |
||
158 | * |
||
159 | * @param Request $request |
||
160 | * |
||
161 | * @return \Symfony\Component\HttpFoundation\Response |
||
162 | */ |
||
163 | public function getCardsRandomAction(Request $request) |
||
191 | |||
192 | /** |
||
193 | * Return request format 'e.g. html, json) |
||
194 | * |
||
195 | * @param RestBundle\View\View $view |
||
196 | * @param Request $request |
||
197 | * |
||
198 | * @return string |
||
199 | */ |
||
200 | protected function getRequestFormat(RestBundle\View\View $view, Request $request) |
||
204 | |||
205 | /** |
||
206 | * Create the web service response |
||
207 | * |
||
208 | * @param array|null|object $content |
||
209 | * @param string $errorMessage |
||
210 | * @param int $code |
||
211 | * |
||
212 | * @return \Moo\FlashCardBundle\Response\RestResponse |
||
213 | */ |
||
214 | protected function createResponse($content, $errorMessage = '', $code = null) |
||
229 | } |
||
230 |
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: