Forums / Developer / contentobject status 5

contentobject status 5

Author Message

Claudia Kosny

Thursday 09 November 2006 12:37:00 am

Hi there

I have created a new datatype which stores some data in an external table.
In the function objectAttributeContent(...) I either want to fetch the data for the current version or, if the current version is a draft, the data of the published version.

The prolem I have is determining whether the the current version is a draft. My current code is like this:

$currentVersion =& $contentObjectAttribute->attribute('object_version');
$currentVersionNr = $currentVersion->attribute('version');
$currentVersionStatus = $currentVersion->attribute('status');

The version number is correct, but the status is set to 5.
According to the documentation the status for a draft is supposed to be 0, a status of 5 is not mentioned at all.

Any idea what is going on?

Claudia

Paul Forsyth

Thursday 09 November 2006 1:43:32 am

What type of object does your datatype return as content?

Looking at the object version class i see this:

define( "EZ_VERSION_STATUS_DRAFT", 0 );
define( "EZ_VERSION_STATUS_PUBLISHED", 1 );
define( "EZ_VERSION_STATUS_PENDING", 2 );
define( "EZ_VERSION_STATUS_ARCHIVED", 3 );
define( "EZ_VERSION_STATUS_REJECTED", 4 );
//define( "EZ_VERSION_STATUS_SHOWN", 5 );

which shows that status 5 is not used.

perhaps your datatype returns something else?

paul

Claudia Kosny

Thursday 09 November 2006 2:37:48 am

Hi Paul

here is the result of print_r($currentVersion):

ezcontentobjectversion Object
(
    [PersistentDataDirty] => 
    [CurrentLanguage] => 
    [ContentObjectAttributeArray] => 
    [DataMap] => 
    [TempNode] => 
    [VersionName] => 
    [VersionNameCache] => Array
        (
        )

    [ID] => 738
    [ContentObjectID] => 201
    [CreatorID] => 14
    [Version] => 5
    [Status] => 5
    [Created] => 1163067858
    [Modified] => 1163067858
    [WorkflowEventPos] => 0
    [UserID] => 0
    [LanguageMask] => 3
    [InitialLanguageID] => 2
)

As you can see I get a contentobjectversion as it should be.The object and the version itself is also correct, I can access the current content of all attributes correctly.

I get similar data for the current version if I fetch all versions of the object using contentobject->versions(false) and then check the data for the version that is currently edited.

Maybe a draft is only a draft with status 0 if it was stored as draft and the status 5 is simply for a toally new version? I have not checked any further as I spent already a considerable amount of time finding out why my code did not work as expected.At the moment my code works fine if I check for status equals 5 or 0 so I will leave it at that for now (unless you can point me to a better solution)

Regards

Claudia

Paul Forsyth

Thursday 09 November 2006 2:50:39 am

Just had a quick look at the latest eZ version and indeed it does have a new value:

define( "EZ_VERSION_STATUS_INTERNAL_DRAFT", 5 );

It allows the system to clean up objects which never became published.

So, your object is a system-created draft. Testing for both 0 and 5 will work.

Read this for more info:

http://pubsvn.ez.no/nextgen/trunk/doc/features/3.8/temporary_drafts.txt

Paul

Claudia Kosny

Thursday 09 November 2006 3:03:58 am

Hi Paul

Thanks a lot - now I don't need to worry whether my code will work or not. I will add the information to the online documentation.

Claudia

eZ debug

Timing: Jan 18 2025 18:16:33
Script start
Timing: Jan 18 2025 18:16:33
Module start 'content'
Timing: Jan 18 2025 18:16:34
Module end 'content'
Timing: Jan 18 2025 18:16:34
Script end

Main resources:

Total runtime1.0316 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 587.6875180.8438
Module start 'content' 0.00660.8466 768.5313504.4375
Module end 'content' 0.85320.1783 1,272.9688338.1250
Script end 1.0315  1,611.0938 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.4090210.0002
Check MTime0.00150.1499210.0001
Mysql Total
Database connection0.00060.060010.0006
Mysqli_queries0.954592.52262000.0048
Looping result0.00210.19931980.0000
Template Total0.997996.720.4990
Template load0.00280.266920.0014
Template processing0.995196.464620.4976
Template load and register function0.00030.025410.0003
states
state_id_array0.00130.123310.0013
state_identifier_array0.00160.155420.0008
Override
Cache load0.00240.2298400.0001
Sytem overhead
Fetch class attribute can translate value0.00210.202730.0007
Fetch class attribute name0.00160.155850.0003
XML
Image XML parsing0.00110.106030.0004
class_abstraction
Instantiating content class attribute0.00000.000950.0000
General
dbfile0.00360.3459210.0002
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs