Author Topic

Håkan Bergman

Wednesday 05 May 2010 12:30:21 am

Comment58936

I tried a different code that will createandpublish:

$Params = array ();
$Params['parent_node_id'] = 92;
$Params['class_identifier'] = 'local_organisation';
$Params['creator_id'] = 14;
$Params['section_id'] = 2;

$AttributesData = array();
$AttributesData['name'] = 'My Company';
$Params['attributes'] = $attributesData;

$ContentObject = eZContentFunctions::createAndPublishObject($Params);

local_organisation is a custom class with one datatype with an identifier called "name".
The attribute have a default identifier "My Company". I have tried to manipulate the attribute data but nothing happens.
Is this a good way to create and publish an object below a parentnode?
Should I do this differently and does anyone know how I can manipulate the datatype data before it submits into the DB?
The code works very nice, but I am concerned if this is done the right way and what I should think of. My main problem right now is how to manipulate data. I have watched a few examples, but nothing works so far when trying to change the name of the attribute "name" from the default value I put in the class.

Best regards,

Håkan