Share the post "How To Show JSON Array Only In Recess PHP Controller"
By default, Recess PHPs’s JsonView class responds with the properties of your controller. So even if you create a custom route that outputs only an array, a default row of the controller’s model will also be included with null values.
You can override this using the OKResponse class. You can do it like this.
|
1 |
return new OkResponse($this->request, array('myarray' => $this->myarray)); |