Saturday 03 May 2008 1:07:10 pm
Hi there's quite a bit of code around to demonstrate how to create and publish objects with php. but they all set the status to published eventually.
There's a wikipage code snippet: http://ezpedia.org/wiki/en/ez/creating_new_content_objects_with_php
Since 3.9, there's the eZContentFunctions::createAndPublishObject() : http://pubsvn.ez.no/nextgen/trunk/kernel/classes/ezcontentfunctions.php
And the csvimport example, which for some reason doesn't use the above method http://pubsvn.ez.no/nextgen/trunk/bin/php/ezcsvimport.php
csvimport uses the new toString() and fromString() datatype methods, roughly described here http://pubsvn.ez.no/nextgen/trunk/doc/features/3.9/to_from_string_datatype_functionality.txt In all these examples, the new object is eventually set to status=published, using
$operationResult = eZOperationHandler::execute( 'content', 'publish'
If you take that functioncall out, the nodeAssignment doesnt seem to work - an object is created, but not assigned to a node. The new object is available in the admin under 'my drafts', but does not have a location/node, and the section is unknown, and versions can not be managed. The "execute( 'content', 'publish' " is actually a chain of actions defined in /kernel/content/operation_definition.php which moves the object through a chain of events: set the new version to pending, setting the current version to archived, setting the new version to published, and do some triggers, cleanup and cache stuff. That makes sense.
So here's the question: is this whole chain of events needed to assign a node to a object ? must a object be set to status=published to get assigned to a node ? In other words, drafts actually have no location ? And archived versions ?
I'm a bit lost here .. *-pike
---------------
The class eZContentObjectTreeNode does.
|