confused by owner, creator, modified, created, published, ..

Author Message

*- pike

Tuesday 02 June 2009 1:38:22 pm

Hi

ezpublish has a number of attributes to choose from to show the history of a node, object, or version. I've found

    * $node.creator (contentobjecttreenode)
    * $node.object.owner (contentobject)
    * $node.object.current.creator (contentobjectversion)
    * $node.object.modified (contentobject)
    * $node.object.published (contentobject)
    * $node.object.current.created (contentobjectversion)
    * $node.object.current.modified (contentobjectversion)

It seems all these values can be different. how do they relate to each other ?
and then, when doing a fetch("content","list", you can sort results by

   * 'sort_by',array('modified',false())
   * 'sort_by',array('published',false())

which values does that refer to ?

confused,
*-pike

---------------
The class eZContentObjectTreeNode does.

Ivo Lukac

Wednesday 03 June 2009 12:41:14 am

'creator' - user who modified (last) version
'owner' - user who created first version, original creator
'published' - time of first creation (can be changed with workflow)
'modified' - time of version change

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

*- pike

Wednesday 03 June 2009 5:34:52 am

hi

so

'owner' = $node.object.owner == $node.object.versions[0].creator
'creator' = $node.creator == $node.object.current.creator
'modified' = $node.object.modified == $node.object.current.modified
'published' = $node.object.versions[0].created
'(unnamed)' = $node.object.current.created

is that correct ? am I missing one ?
what keeps those values in sync ?

thanks,
*-pike

---------------
The class eZContentObjectTreeNode does.

Ivo Lukac

Wednesday 03 June 2009 5:52:34 am

AFAIK that is it.

Don't know exactly what $node.object.current.created is. Probably that is time when draft is created and $node.object.current.modified is when the draft is saved. Or something like that.

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

*- pike

Thursday 04 June 2009 11:42:17 am

Thanks - let me be more specific.

I need to *set* the creation date, modification date, creator and owner on a node, using PHP. But I'm not really sure what to set, to start with.

I've tried

$version->setAttribute( 'created', $set_created);
$version->setAttribute( 'creator_id', $set_creator_id);
$version->setAttribute( 'modified', $set_modified);

where $version is a current contentObjectVersion, and then did a

$operationResult = eZOperationHandler::execute( 'content','publish', array(
 	'object_id' => $version->attribute( 'contentobject_id' ),
	'version' => $version->attribute( 'version' ) 
) );

The result in the admin interface is even more confusing. The values seem to be set on the current version, but the *object's* modifier is me and the modification date now.

Does anyone know how to do this ?

thanks,
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 10 July 2009 10:17:27 am

The fact that the admin (history page) is confusing may be due to a bug in the admin:
http://issues.ez.no/IssueView.php?Id=15157

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 10 July 2009 10:30:46 am

I'm testing a bit .. since nobody knows and imho its a bit of a mess there :-)
So I'm pushing numbers straight into the database using SQL to see what *output* changes in the template operators. I can not, this way, see what internal php logic would keep the several values in sync, or how.

the treenode has no fields in the database to store userids, so $node.creator must be read from either the object beneath the node or one of its versions. I should add I'm using ezp 4.03.

I'm focusing on 4 things:
- the object
- the initial version from $object.versions[0]
- the initial version from fetch('content','version_list',..)
- the current version from $object.current

It should be noted both initial versions return different objects, allthough they have the same $version.id, see http://issues.ez.no/IssueView.php?Id=15158

If I change initial version creator id in the db
	this changes: 
                $initialfetched.creator
	
If I change current version creator id  in the db
	these change:
		$node.creator
		$node.object.versions[0].creator (that seems wrong)
		$node.object.current.creator 
	but this doesnt
		$node.object.owner

If I change object owner id  in the db
	only this changes:
		$node.object.owner

So $node.object.owner may be synced by some other internal method in php, eg content/publish. And $node.object.versions[0].creator seems to be incorrect. the admin history page uses the fetch(content.version_list and shows the right values.

More to come,
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Friday 10 July 2009 11:21:49 am

I did the same for 'version.created', 'version.modified', 'object.modified' and 'object.published'.

change initial version "created"
	this changes
		initialfetched.created
		
change initial version "modified"
	this changes
		initialfetched.modified
		
change current version "created"
	changes
		$node.object.versions[0].created (that seems wrong)
		$node.object.current.created
		
change current version "modified"
	changes
		$node.object.versions[0].modified (that seems wrong)
		$node.object.current.modified
		
change object "created"
	changes
		$node.object.created

change object "published"
	changes
		$node.object. published

So again, $node.object.* seems to be kept in sync using php, and $node.object.versions[0] seems wrong.

That doesnt really answer my original question :-) But I know a bit more now:

To change $node.creator, I have to change $node.object.current.creator

To change $node.object.owner, I can just set it in SQL. Common sense tells me to update the "creator" of the first version as well.

To change $node.object.modified, I can just set it in SQL. Common sense tells me to update the "modified" of the current version as well.

.. and $node.object.published i can apparently just set using SQL. Common sense tells me to update the "modified" of the first version as well.

And
* 'sort_by',array('modified',false())
* 'sort_by',array('published',false())
will most likely sort by $object.modified and $object.published, allthough i havent checked that.

$2c,
*-pike

 

---------------
The class eZContentObjectTreeNode does.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.