Thursday 19 November 2009 1:52:35 am
Wher writing CLI scritps I try to keep the fetch on the "outside of the for/foreach" as small as possible.
Best way would be a SQL fetch with all the nodes I need. (The advantage is: I can use LIMIT to run the script for a part of the result. Change the offset and append the next result to the output file.) If You need to use the fetch functions, I would try the 'load_data_map' paramter like this:
$parentNodeID = 5;
$users =& eZContentObjectTreeNode::subTreeByNodeId(
array( 'ClassFilterType' => 'include',
'ClassFilterArray' => array( 'user' ),
'SortBy' => array( 'published', false),
'LoadDataMap' => false
),
$parentNodeID);
$i = 0;
foreach( $users as $user ) {
$usrObj = eZContentObject::fetch( $user->attribute('contentobject_id') );
$dataMap =& $usrObj->attribute( 'data_map' );
... do something
unset( $dataMap );
unset( $usrObj );
} 'inside' the foreach fetch the datamap and unset all variables that are being used.
www.all2e.com
|