Forums / General / Inverted related objects not updated

Inverted related objects not updated

Author Message

Gwenal Le Bihan

Tuesday 03 February 2009 9:47:26 am

Hi,

I have this message in the error.log :

[ Jan 05 2009 15:08:08 ] [192.168.1.116] eZContentObject::fetch():
Object not found (7204)

I've deleted an object (id 7204) from the media that was related with an article in the contents (object relation). I had a message warning me that there was a relation with the article, but i still erased the object, thinking that the data_int value would be set to 0 instead of remaining set to 7204, but it's not! As a result, even if in the admin when i edit the article, my object relation is showing 'no relation', on the front end, it's causing a message in the error.log, it's still trying to fetch this 'no longer existing' object.

Is this a normal behaviour that deleting an object doesn't update the (inverted) related objects? I'm using eZ4.0.1..

Thank you very much

Gwen

Gwenal Le Bihan

Wednesday 04 February 2009 2:49:19 am

A little precision..

It only happens when i delete the relate object without leaving it in the trash. There is no update of my "calling" object in this case but if i delete the related object and leave it in the trash, then my "calling" object is updated and the related object attribute value is set to 0.

I can't see why there is a difference between the two operations..

I hope I'm clear in my explanations.. :-$

G

Gwenal Le Bihan

Wednesday 04 February 2009 3:09:50 am

oups little mistake: the attribute "calling" object is not set to 0 when the deleted related object is left in the trash. It seems i don't have an error in my log just because the fetch is still possible even if placed in the trash but it doesn't answer my first question about the update of my attribute, if this is a normal behaviour.

I would assume that removing an object updates all reverse related objects but it seems it's not the case :-(

anybody to confirm?..

thx

Gwen

Fabien Mas

Thursday 05 February 2009 6:40:18 am

When you delete an object, the "fixReverseRelations" function (ezcontentobject.php) is called

This function call the "fixRelatedObjectItem" function of the datatype linked to your object

In your case, the datatype is : ezobjectrelation
But the fixRelatedObjectItem is not implemented in this datatype so , the fixRelatedObjectItem function used here is the one of the eZDataType class who does nothing

 function fixRelatedObjectItem( $contentObjectAttribute, $objectID, $mode )
    {
    }

Is it a bug ??

Fabien

André R.

Thursday 05 February 2009 9:44:46 am

>> Is it a bug?

Yes, please create a issue for it and add a link to this thread in it.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Fabien Mas

Friday 06 February 2009 12:39:20 am

It's done :
http://issues.ez.no/IssueView.php?Id=14411&activeItem=1