Forums / Developer / Node assignment and node_ID

Node assignment and node_ID

Author Message

Olav Bringedal

Thursday 24 February 2005 1:12:42 am

I have written a script thats imporing products. Since there's around 500 of them id like them categorised into folders. This is a part of the script that does that, and it works. However the last part with ($node =& eZContentObjectTreeNode::fetch($node_id)) seems to me as pretty unnecceary, as I'd say it was natural that EznodeAssignment somehow contained that node_id after storing. Is it just me overlooking something obvious?

		$folderclass =& eZContentClass::fetch( 1 );
		
		$contentObject =& $folderclass->instantiate( $userID, 1 );
		$contentObject->setAttribute( 'name', $folder['navn'] );
		$contentObject->store();
			
		//assign new object to parent node
		$nodeAssignment =& eZNodeAssignment::create( array(
			'contentobject_id' => $contentObject->attribute( 'id' ),
			'contentobject_version' => $contentObject->attribute( 'current_version' ),
			'parent_node' => $merch_node,
			'is_main' => 0)	);
				
		$nodeAssignment->store();
				
		//snipped version code
	}
		
	$node =& eZContentObjectTreeNode::fetch($node_id);
	$children =& $node->subTree( array( 'Limitation' => array() ) );
	foreach ($children as $child)
	{
		//Set each products group to $child->MainNodeID;
		
	}


Senior Consultant
http://Umoe-consulting.no

Eirik Alfstad Johansen

Thursday 24 February 2005 9:12:45 am

Hi Olav,

Have you tried $nodeAssignment->attribute("id") ?

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Olav Bringedal

Friday 25 February 2005 12:45:03 am

Thanks, I wish it was that easy :)

debug shows that's the unique id of the node assigmnent

class eznodeassignment {
  var $PersistentDataDirty = false;
  var $ID = 6875;
  var $RemoteID = 0;
  var $ParentRemoteID = '';
  var $ContentobjectID = 6868;
  var $ContentObjectVersion = 1;
  var $ParentNode = 69;
 ...
}

the folder itself gets the values: 

class ezcontentobjecttreenode {
 ...
  var $Name = 'Billetter';
  var $ClassIdentifier = 'folder';
  var $ClassName = 'Folder';
  <b> var $NodeID = '4359';</b>
  var $ParentNodeID = '69';
  var $MainNodeID = '4359'; 
  var $ContentObjectID = '6868';
...
}


Senior Consultant
http://Umoe-consulting.no

eZ debug

Timing: Jan 18 2025 11:24:40
Script start
Timing: Jan 18 2025 11:24:40
Module start 'content'
Timing: Jan 18 2025 11:24:40
Module end 'content'
Timing: Jan 18 2025 11:24:41
Script end

Main resources:

Total runtime0.8212 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.7109180.8359
Module start 'content' 0.00600.6591 768.5469549.5000
Module end 'content' 0.66510.1561 1,318.0469336.7500
Script end 0.8212  1,654.7969 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.4875210.0002
Check MTime0.00150.1789210.0001
Mysql Total
Database connection0.00070.091010.0007
Mysqli_queries0.736289.64031940.0038
Looping result0.00220.26261920.0000
Template Total0.795096.820.3975
Template load0.00200.248020.0010
Template processing0.793096.559320.3965
Template load and register function0.00010.017710.0001
states
state_id_array0.00070.089710.0007
state_identifier_array0.00100.124220.0005
Override
Cache load0.00160.1997150.0001
Sytem overhead
Fetch class attribute can translate value0.00160.198530.0005
Fetch class attribute name0.00120.141250.0002
XML
Image XML parsing0.00130.162830.0004
class_abstraction
Instantiating content class attribute0.00000.001660.0000
General
dbfile0.01291.5685330.0004
String conversion0.00000.000830.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs