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/

eZ debug

Timing: Jan 18 2025 04:55:28
Script start
Timing: Jan 18 2025 04:55:28
Module start 'content'
Timing: Jan 18 2025 04:55:28
Module end 'content'
Timing: Jan 18 2025 04:55:28
Script end

Main resources:

Total runtime0.8285 sec
Peak memory usage4,096.0000 KB
Database Queries197

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 587.7109180.8359
Module start 'content' 0.00550.6880 768.5469561.0781
Module end 'content' 0.69360.1348 1,329.6250336.7500
Script end 0.8284  1,666.3750 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.5027210.0002
Check MTime0.00150.1854210.0001
Mysql Total
Database connection0.00060.076510.0006
Mysqli_queries0.744389.83831970.0038
Looping result0.00210.24961950.0000
Template Total0.794795.920.3974
Template load0.00210.251020.0010
Template processing0.792795.678920.3963
Template load and register function0.00010.012910.0001
states
state_id_array0.00130.153910.0013
state_identifier_array0.00270.321220.0013
Override
Cache load0.00170.2094290.0001
Sytem overhead
Fetch class attribute can translate value0.00110.135130.0004
Fetch class attribute name0.00170.201460.0003
XML
Image XML parsing0.00320.392030.0011
class_abstraction
Instantiating content class attribute0.00000.001780.0000
General
dbfile0.01021.2311340.0003
String conversion0.00000.002430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs