[TYPO3-mvc] Pass Arguments to a forward call

Robert Schneider r.schneider at artworx.at
Wed Aug 29 09:08:41 CEST 2012


I've found my problem!

The passing of the arguments was okay. What I didn't do was to forward 
the arguments in the called action. I had to add the following lines in 
the register action:

public function registerAction(
   Tx_Psa_Domain_Model_PsaUser $user = NULL) {
   ...
   if($this->request->hasArgument('warnings'))
     $this->view->assign('warnings',
       $this->request->getArgument('warnings'));
   ...
}

So this forwarding of the arguments does not happen automatically as I 
thought. It has to be done manually.

Now it works.

Thanks again Claus.
Greeting from Austria,
Robert


Am 28.08.2012 18:11, schrieb Claus Due:
> Hi Robert,
>
> This should work:
>
> $this->forward($action, NULL, NULL, $this->request->getArguments());
>
> See also this, and other setters/getters on the same class:
>
> http://fedext.net/request/web-request.html#setArgument
>
> …for information about how to manipulate the arguments before forwarding them.
>
> Cheers,
> Claus
> http://fedext.net
>
> On Aug 28, 2012, at 5:43 PM, Robert Schneider <r.schneider at artworx.at> wrote:
>
>> I try to forward to an action in my controller. I'm able to pass an Tx_Extbase_DomainObject_AbstractEntity. However, I'm not able to pass some 'normal' arguments.
>>
>> Here is what I have in short in the controller:
>>
>> $args             = array();
>> $args['user']     = $user;
>> $args['warnings'] = $warnings;
>> $this->forward('register', NULL, NULL, $args);
>>
>> The user object which is actually an Tx_Extbase_Domain_Model_FrontendUser object gets passed without any problems. But the $warnings array does not. It's just an string array. The template looks like this (only the problem part here):
>>
>> <f:if condition="{warnings}">
>>     Some warnings:
>>     <ul>
>>         <f:for each="{warnings}" as="w">
>>             <li>{w}</li>
>>         </f:for>
>>     </ul>
>> </f:if>
>>
>> But the warn messages does not get shown. I guess I have to pass the warnings different.
>>
>> Could anyone give me a hint?
>>
>> Robert
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>



More information about the TYPO3-project-typo3v4mvc mailing list