[TYPO3-mvc] Non-existing element in single view

Daniel Schöne daniel at schoene.it
Wed Apr 25 13:18:05 CEST 2012


Hi Chris,

I think the way to go is mark the parameter as optional and handle the missing parameter by hand:

/**
* @param Tx_MyExtensionName_Domain_Model_Foobar
*/
public function showAction ($foobar = NULL) {
	if ($foobar === NULL) {
		// do something or handle in view
	} else {
		// do stuff
 	}
}
	

daniel

On 25.04.2012, at 13:04, Chris Müller wrote:

> Hi,
> 
> I made my first extbase extension with a list and single view. Everything works fine.
> 
> In the single view I'm getting a parameter with the uid of the requested item. But if this uid doesn't exists there is a TYPO3 exception thrown:
> 
> The value must be of type "Tx_MyExtensionName_Domain_Model_Foobar", but was of type "NULL".
> 
> This is not what I want the website user to see. Instead he should see a customized error message in the website layout.
> 
> Where can I catch this exception and how can I show a nice error message to the user?
> 
> Regards,
> Chris.
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> 

-- 
Daniel Schöne





More information about the TYPO3-project-typo3v4mvc mailing list