[TYPO3-mvc] How to pass null to a setter that expects an object

Nathan Lenz typo3 at k9tfk.com
Fri Jan 15 16:17:20 CET 2010


Sebastian Kurfürst wrote:
> Hi,
> 
> 
>> /**
>>  * set the favorite property
>>  * @param Tx_Myext_Domain_Model_Property $property Your favortite
>>  */
>> public function setFavorite(Tx_Myext_Domain_Model_Property $property) {
>>     $this->favorite = $property;
>> }
> Try
> public function setFavorite(Tx_Myext_Domain_Model_Property $property =
> NULL) {
> }
> 
> Greets,
> Sebastian

Thanks Sebastian,
I had tried that and it doesn't work. I also tried that in combination
with: @dontvalidate $property (Even though I'd like it to be validated
if it's not null.)

It still get's hung-up in the $mapper with "Expected parameter 1 to be
object, NULL given".

Thanks,
--Nathan


More information about the TYPO3-project-typo3v4mvc mailing list