[TYPO3-mvc] own Tx_Extbase_MVC_Exception_InvalidArgumentValue handler

Simon Schaufelberger (Schaufi) simonschaufi at jesus.de
Sat Jul 7 13:42:20 CEST 2012


Hi,

i need some help with extbase internals.

i found this very helpful snippet to avoid exceptions if the url 
contains an invalid id of an object like 
index.php?tx_myext_pi1[foo]=2&<controller, action...>

https://gist.github.com/1014442

i modified it a bit to add a flash message and redirect to another page. 
the redirect works but the flash message will not be show.

This is the code in my controller:

/**
  * @return void
  */
public function mapRequestArgumentsToControllerArguments() {
	try {
		parent::mapRequestArgumentsToControllerArguments();
	} catch (Tx_Extbase_MVC_Exception_InvalidArgumentValue $exception) {
		$this->flashMessageContainer->add('test');
		$this->redirect('list', 'Advertisement', NULL, NULL, 'pinboard');
	}
}

when i print_r() of the flashMessageContainer, i get an object back. i 
don't know much about extbase internals but somehow this flash message 
will not be added correctly. i guess since this code will be executed 
quite early, the flashMessageContainer is not setup correctly at this time.

what must i do to setup flashMessageContainer so that the flashmessage 
will be stored in the session and will be printed out on the redirected 
page?
-- 
Regards, Schaufi



More information about the TYPO3-project-typo3v4mvc mailing list