eZ Community » Forums » eZ Publish 5 Platform » Public API Assign ObjectStates
expandshrink

Public API Assign ObjectStates

Public API Assign ObjectStates

Tuesday 25 November 2014 2:41:34 pm

Hello eZ-Forum,

i am having a hard fight with the public api. It seems to have lots of potential but it lacks of documentation. I am trying to set the state of an content object while updating or creating it with the public api. 

In the kernel there is a contentObjectStateService, from which i can create a newObjectStateCreateStruct or a newObjectStateUpdateStruct but i can find any useful documentation or code examples how to set the objectstate while updating or creating a contentobject.

It would be a real pleasure to get some help from you.

Best regards,

Jacob

Edit:

Found a way, but is there no "better" way, without hardcoding the desired stateid?

$group = $objectStateService->loadObjectStateGroup( 2 );             
//States at position 5 is desired state, stategroup with id 2 desired group
$states = $objectStateService->loadObjectStates($group);
$testvar = $objectStateService->setContentState( $content->contentInfo, $group, $states[5] );<span style="font-size: 1.1em;"> </span>

Modified on Tuesday 25 November 2014 4:09:28 pm by Jacob Ester

No reply yet!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from