[TYPO3-mvc] spl_object_hash not matching when using in Fluid ajax widget

Jonas Götze jonnsn at gmail.com
Tue Mar 8 15:36:34 CET 2011


Hi Dennis,

Am 08.03.2011 15:19, schrieb Dennis Ahrens:
> Hi Jonas,
>
> On 08.03.2011 14:57, Jonas Götze wrote:
>> foreach($myObjectStorage as $object){
>> if($obj === $objectToRemove)
>> // do something if they match
>> else
>> // do something if they did not match
>> }
>>
>> This always resulted in the else-case.
>
> Have you checked, if there are clones involved? The === operator will
> not return true, if one of the compared objects is a clone of the
> original one.
>
> regards
> Dennis

No I haven't - how would I check this?
I do not clone any objects in my code (or I am not aware of it - I set 
it up with the kickstarter, but have not seen something like clone yet).
What I forgot to mention is, that if I call something like the following 
in a "normal" controller (e.g. the edit Action where the widget will be 
rendered afterwards) it works:

$objectToRemove = $this->myRepository->findByUid($UidOfObjectToRemove);
$myObject->removeMyStorageProperty($objectToRemove);

I also tried to get the $objectToRemove in the WidgetController using 
$this->myRepository->findByUid - but that will have the same 
spl_object_hash as the object from the actionArguments and won't work 
neither therefor.

Regards
Jonas


More information about the TYPO3-project-typo3v4mvc mailing list