Forums / Developer / [PHP] Deleting object relations

[PHP] Deleting object relations

Author Message

Anders Berre

Tuesday 09 December 2008 12:05:47 pm

I am currently working on a 3.10.1 installations.

I have made a script where I wan't to delete/clean the object relation list from an attribute of an object.

Lest say I have a class with the object list attribute: person_list

I fetch the object:

$object 		= eZContentObject::fetch( 303 );
$data_map	= $object->DataMap();
$person_list    = $data_map[ 'person_list' ];
$person_list_content = $start->content();

Now I want to delete the content of $person_list, so this is empty.

I tried with this:

eZObjectRelationListType::deleteStoredObjectAttribute( $person_list );

But without any luck.

Any suggestions how to empty the relation_list in $person_list?

Sincerely,

Anders Sandvik Berre
http://www.netmaking.no/

Arnaud Lafon

Wednesday 10 December 2008 1:29:42 am

Hi Anders,

I think you'll find everything you need in the ezobjectrelationtype.php file which controls how ezpublish manage object relation via datatype, especially in the storeObjectAttribute() and fetchObjectAttributeHTTPInput() functions. You can also have a look inside the ezobjectrelationlist If you need multiple relation functionnality.
With a step by step debugger you'll be able to understand and reproduce what you need.

Hope this helps.

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Anders Berre

Wednesday 10 December 2008 9:32:32 am

Thanks for your answear. I have, as I wrote in my first post, tried to the delete-functions in that file. But I will take a look in thoose two functions you told me about.

If anyone else have some input on this topic. I would be very happy to see what they have on their mind :)

Sincerely,

Anders Sandvik Berre
http://www.netmaking.no/

Anders Berre

Thursday 11 December 2008 5:48:22 am

I managed to fix my issue.

The problem was as easy as I did not set the new content to the object.

If someone is interested, I could copy/paste the code.

Sincerely,

Anders Sandvik Berre
http://www.netmaking.no/