Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

json

Всем привет. Есть класс User. Нужно вернуть json в представление. Пишу: public function indexAction() { $users = User::find(); var_dump(json_encode($users)); //$this->view->partial('users', $users); } Получаю: string(2) "{}"

Вопрос решен, сорри...



40.4k
Accepted
answer
var_dump($users->toArray());
$json = json_encode($user->toArray());
var_dump($json);