kernel/content/ezcontentoperationcollection.php
static public function updateObjectState( $objectID, $selectedStateIDList )
    {
        $object = eZContentObject::fetch( $objectID );

        // we don't need to re-assign states the object currently already has assigned
        $currentStateIDArray = $object->attribute( 'state_id_array' );
        $selectedStateIDList = array_diff( $selectedStateIDList, $currentStateIDArray );

        // filter out any states the current user is not allowed to assign
        $canAssignStateIDList = $object->attribute( 'allowed_assign_state_id_list' );
        $selectedStateIDList = array_intersect( $selectedStateIDList, $canAssignStateIDList );

        foreach ( $selectedStateIDList as $selectedStateID )
        {
            $state = eZContentObjectState::fetchById( $selectedStateID );
            $object->assignState( $state );
        }
        eZAudit::writeAudit( 'state-assign', array( 'Content object ID' => $object->attribute( 'id' ),
                                                    'Content object name' => $object->attribute( 'name' ),
                                                    'Selected State ID Array' => implode( ', ' , $selectedStateIDList ),
                                                    'Comment' => 'Updated states of the current object: eZContentOperationCollection::updateObjectState()' ) );
        //call appropriate method from search engine
        eZSearch::updateObjectState($objectID, $selectedStateIDList);

        // Triggering content/state/assign event for persistence cache purge
        ezpEvent::getInstance()->notify( 'content/state/assign', array( $objectID, $selectedStateIDList ) );

        eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

        return array( 'status' => true );
    }
static public function updateObjectState( $objectID, $selectedStateIDList )
    {
        $object = eZContentObject::fetch( $objectID );

        // we don't need to re-assign states the object currently already has assigned
        $currentStateIDArray = $object->attribute( 'state_id_array' );
        $selectedStateIDList = array_diff( $selectedStateIDList, $currentStateIDArray );

        // filter out any states the current user is not allowed to assign
        $canAssignStateIDList = $object->attribute( 'allowed_assign_state_id_list' );
        $selectedStateIDList = array_intersect( $selectedStateIDList, $canAssignStateIDList );

        foreach ( $selectedStateIDList as $selectedStateID )
        {
            $state = eZContentObjectState::fetchById( $selectedStateID );
            $object->assignState( $state );
        }
        eZAudit::writeAudit( 'state-assign', array( 'Content object ID' => $object->attribute( 'id' ),
                                                    'Content object name' => $object->attribute( 'name' ),
                                                    'Selected State ID Array' => implode( ', ' , $selectedStateIDList ),
                                                    'Comment' => 'Updated states of the current object: eZContentOperationCollection::updateObjectState()' ) );
        //call appropriate method from search engine
        eZSearch::updateObjectState($objectID, $selectedStateIDList);

        // Triggering content/state/assign event for persistence cache purge
        ezpEvent::getInstance()->notify( 'content/state/assign', array( $objectID, $selectedStateIDList ) );

        eZContentCacheManager::clearContentCacheIfNeeded( $objectID );

        return array( 'status' => true );
    }
static public function updateObjectState ( $ objectID , $ selectedStateIDList ) { $ object = eZContentObject :: fetch ( $ objectID ) ; // we don't need to re-assign states the object currently already has assigned $ currentStateIDArray = $ object -> attribute ( 'state_id_array' ) ; $ selectedStateIDList = array_diff ( $ selectedStateIDList , $ currentStateIDArray ) ; // filter out any states the current user is not allowed to assign $ canAssignStateIDList = $ object -> attribute ( 'allowed_assign_state_id_list' ) ; $ selectedStateIDList = array_intersect ( $ selectedStateIDList , $ canAssignStateIDList ) ; foreach ( $ selectedStateIDList as $ selectedStateID ) { $ state = eZContentObjectState :: fetchById ( $ selectedStateID ) ; $ object -> assignState ( $ state ) ; } eZAudit :: writeAudit ( 'state-assign' , array ( 'Content object ID' => $ object -> attribute ( 'id' ) , 'Content object name' => $ object -> attribute ( 'name' ) , 'Selected State ID Array' => implode ( ', ' , $ selectedStateIDList ) , 'Comment' => 'Updated states of the current object: eZContentOperationCollection::updateObjectState()' ) ) ; //call appropriate method from search engine eZSearch :: updateObjectState ( $ objectID , $ selectedStateIDList ) ; // Triggering content/state/assign event for persistence cache purge ezpEvent :: getInstance ( ) -> notify ( 'content/state/assign' , array ( $ objectID , $ selectedStateIDList ) ) ; eZContentCacheManager :: clearContentCacheIfNeeded ( $ objectID ) ; return array ( 'status' => true ) ; }
Update a contentobject's state

@param int $objectID
@param int $selectedStateIDList

@return array An array with operation status, always true
Update a contentobject s state