[TYPO3-dev] Parameter in Action does not work for every action

Dirk Ho dirk_studivz at web.de
Fri Aug 15 23:19:50 CEST 2014


Hi all,

in my ForumController I have two actions:

     /**
      * action list
      *
      * @param \DH\Forum\Domain\Model\Forum $forum
      *
      * @return void
      */
     public function listAction(\DH\Forum\Domain\Model\Forum $forum) {...}

     /**
      * action show
      *
      * @param \DH\Forum\Domain\Model\Forum $forum
      * @return void
      */
     public function showAction(\DH\Forum\Domain\Model\Forum $forum) {...}

in my Forum\list.html I entered
<f:link.action controller="Forum" action="show" arguments="{forum : 
forum}">{forum.title}</f:link.action>

(the action used is show or list).

When I click the link with the action "show" the param is set in the 
showAction method as expected. When I click the link with action "list" 
I get the exception

Oops, an error occurred!

PHP Catchable Fatal Error: Argument 1 passed to 
DH\Forum\Controller\ForumController::listAction() must be an instance of 
DH\Forum\Domain\Model\Forum, none given in 
/media/sf_Virtual_Box_Shared_Folder/t3_forum/forum/Classes/Controller/ForumController.php 
line 57

Any idea, why this happens or does not work? Is there also a possibility 
to do cross controller parameter injection? This means in my 
Category\list.html I would like to set a f:link with arguments {category 
: category} and the controller Forum and the action list.

If now someone clicks a category, I want to show the categories forums.

Is this possible or do I have to use the Category controller with action 
show and do a redirect to the Forum\list view?

Thanks and best wishes,

Dirk



More information about the TYPO3-dev mailing list