eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler::loadObjectStates PHP Méthode

loadObjectStates() public méthode

This method returns the ordered list of object states of a group.
public loadObjectStates ( mixed $groupId ) : eZ\Publish\SPI\Persistence\Content\ObjectState[]
$groupId mixed
Résultat eZ\Publish\SPI\Persistence\Content\ObjectState[]
    public function loadObjectStates($groupId)
    {
        $data = $this->objectStateGateway->loadObjectStateListData($groupId);
        return $this->objectStateMapper->createObjectStateListFromData($data);
    }

Usage Example

 /**
  * Returns an array of default content states with content state group id as key.
  *
  * @return \eZ\Publish\SPI\Persistence\Content\ObjectState[]
  */
 protected function getDefaultContentStates()
 {
     $defaultObjectStatesMap = array();
     foreach ($this->objectStateHandler->loadAllGroups() as $objectStateGroup) {
         foreach ($this->objectStateHandler->loadObjectStates($objectStateGroup->id) as $objectState) {
             // Only register the first object state which is the default one.
             $defaultObjectStatesMap[$objectStateGroup->id] = $objectState;
             break;
         }
     }
     return $defaultObjectStatesMap;
 }