[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/

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:04:39
Script start
Timing: Jan 18 2025 11:04:39
Module start 'layout'
Timing: Jan 18 2025 11:04:39
Module start 'content'
Timing: Jan 18 2025 11:04:40
Module end 'content'
Timing: Jan 18 2025 11:04:40
Script end

Main resources:

Total runtime0.9430 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 589.0313152.6250
Module start 'layout' 0.00620.0039 741.656339.4453
Module start 'content' 0.01010.9310 781.1016556.0000
Module end 'content' 0.94110.0018 1,337.101612.1641
Script end 0.9429  1,349.2656 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.3668160.0002
Check MTime0.00140.1526160.0001
Mysql Total
Database connection0.00110.115210.0011
Mysqli_queries0.879993.3092600.0147
Looping result0.00090.0960580.0000
Template Total0.908596.320.4542
Template load0.00260.278120.0013
Template processing0.905896.062720.4529
Template load and register function0.00010.012610.0001
states
state_id_array0.00110.117210.0011
state_identifier_array0.00110.120720.0006
Override
Cache load0.00190.2034290.0001
Sytem overhead
Fetch class attribute can translate value0.00070.069420.0003
Fetch class attribute name0.00110.121660.0002
XML
Image XML parsing0.00120.125120.0006
class_abstraction
Instantiating content class attribute0.00000.002180.0000
General
dbfile0.00100.1068230.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs