Ejemplo n.º 1
0
 /**
  * Returns the object states of content.
  *
  * @param $contentId
  *
  * @return \eZ\Publish\Core\REST\Common\Values\ContentObjectStates
  */
 public function getObjectStatesForContent($contentId)
 {
     $groups = $this->objectStateService->loadObjectStateGroups();
     $contentInfo = $this->contentService->loadContentInfo($contentId);
     $contentObjectStates = array();
     foreach ($groups as $group) {
         try {
             $state = $this->objectStateService->getContentState($contentInfo, $group);
             $contentObjectStates[] = new RestObjectState($state, $group->id);
         } catch (NotFoundException $e) {
             // Do nothing
         }
     }
     return new ContentObjectStates($contentObjectStates);
 }
Ejemplo n.º 2
0
 /**
  * Gets the object-state of object identified by $contentId.
  *
  * The $state is the id of the state within one group.
  *
  * @param \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
  *
  * @return \eZ\Publish\API\Repository\Values\ObjectState\ObjectState
  */
 public function getContentState(ContentInfo $contentInfo, ObjectStateGroup $objectStateGroup)
 {
     return $this->service->getContentState($contentInfo, $objectStateGroup);
 }