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

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 16:03:59
Script start
Timing: Jan 18 2025 16:03:59
Module start 'layout'
Timing: Jan 18 2025 16:03:59
Module start 'content'
Timing: Jan 18 2025 16:03:59
Module end 'content'
Timing: Jan 18 2025 16:03:59
Script end

Main resources:

Total runtime0.6306 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 589.0313152.6250
Module start 'layout' 0.00540.0024 741.656339.4453
Module start 'content' 0.00790.6212 781.1016544.4219
Module end 'content' 0.62910.0015 1,325.523412.1641
Script end 0.6306  1,337.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4991160.0002
Check MTime0.00140.2191160.0001
Mysql Total
Database connection0.00060.099210.0006
Mysqli_queries0.585992.9104570.0103
Looping result0.00050.0851550.0000
Template Total0.603895.720.3019
Template load0.00200.314020.0010
Template processing0.601895.432920.3009
Template load and register function0.00010.017010.0001
states
state_id_array0.00090.139510.0009
state_identifier_array0.00150.239020.0008
Override
Cache load0.00160.2600150.0001
Sytem overhead
Fetch class attribute can translate value0.00070.105920.0003
Fetch class attribute name0.00120.186850.0002
XML
Image XML parsing0.00150.241220.0008
class_abstraction
Instantiating content class attribute0.00000.001660.0000
General
dbfile0.00140.2168220.0001
String conversion0.00000.001340.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
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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs