protected function getJsonView($data, \Request $request) { $command = $request->getVar('command'); $factory = new Factory(); switch ($command) { case 'list': $json = $factory->getList(); break; } $view = new \View\JsonView($json); return $view; }