[TYPO3-50-general] How to get JSON View

Karsten Dambekalns karsten at typo3.org
Mon Nov 9 10:18:53 CET 2009


Hi.

On 04.11.09 13:10, Andreas Lappe wrote:
> public function showAction(\F3\Proyectito\Domain\Model\Todolist $todolist) {
>   $this->view->assign('todolist', $todolist);
>   $this->view->assign('todos', $this->todoRepository->findByTodolist($todolist));
> }
> 
> which works fine for the standard html/fluid view. But as I cannot use
> fluid to access `todolist´ in my json-view, I have to write it like
> this:
> 
> public function showAction(\F3\Proyectito\Domain\Model\Todolist $todolist) {
>   $this->view->todolist = $todolist;
>   $this->view->todos = $this->todoRepository->findByTodolist($todolist);
> }

You should have an assign() method in your view that does (in the
simplest case) "$this->todolist = $todolist". Then assign() would work
the same way as your second way. No?!?

Regards,
Karsten


More information about the TYPO3-project-5_0-general mailing list