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

Dennis Ahrens dennis.ahrens at googlemail.com
Tue Mar 8 15:58:39 CET 2011


On 08.03.2011 15:36, Jonas Götze wrote:
> No I haven't - how would I check this?

You can check it by calling _isClone() on the domain object.

> 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.

I would expect findByUid to return the original object instead of clone 
as you do. Maybe there are cloned objects in the object storage?

Maybe it helps, if you do the comparison like this:

if ($obj->getUid() === $object->getUid() && get_class($obj) === 
get_class($object)) { } else {}

Not that clean - but this should also make sure, that it is the same 
object (without respecting any changes in the objects).

regards
Dennis


More information about the TYPO3-project-typo3v4mvc mailing list