Wednesday 09 June 2010 5:09:26 am
Hi David Thanks for this piece of knowledge :) However, I noticed that you access information from your objects directly from their properties :
//setting general node details
$params = array();
$params ['class_identifier'] = 'folder'; //class name (found within setup=>classes in the admin if you need it
$params['creator_id'] = $user->ContentObjectID;//using the user created above
$params['parent_node_id']=$parent_node->NodeID;//pulling the node id out of the parent
$params['section_id'] = $parent_node->ContentObject->SectionID; This is a bad practice as you should access these informations using the attribute() accessor method, as eZContentObject inherits from eZPersistentObject. With this accessor, you can access to the very same properties than in templates as described in the online doc :
//setting general node details
$params = array();
$params ['class_identifier'] = 'folder'; //class name (found within setup=>classes in the admin if you need it
$params['creator_id'] = $user->attribute( 'contentobject_id' ); //using the user created above
$params['parent_node_id']=$parent_node->attribute( 'node_id' );//pulling the node id out of the parent
$params['section_id'] = $parent_node->attribute( 'object' )->attribute( 'section_id' ); This notice is available for all PHP classes inheriting from eZPersistentObject, which is the case for number of eZ Publish PHP classes. To view all available properties for these classes, see their static method definition() (field and function_attributes keys). See eZContentObject::definition() in API doc. Another quick note about XML blocks (rich text) : It's better to use the input parser from eZOE extension (eZOEInputParser), which supports lots of additional HTML tags rather than eZSimplifiedInputParser ;-)
|