eZ\Publish\Core\Persistence\Cache\ObjectStateHandler::getContentState PHP Method

getContentState() public method

See also: eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::getContentState
public getContentState ( $contentId, $stateGroupId )
    public function getContentState($contentId, $stateGroupId)
    {
        $cache = $this->cache->getItem('objectstate', 'byContent', $contentId, $stateGroupId);
        $stateId = $cache->get();
        if ($cache->isMiss()) {
            $this->logger->logCall(__METHOD__, array('contentId' => $contentId, 'stateGroupId' => $stateGroupId));
            $contentState = $this->persistenceHandler->objectStateHandler()->getContentState($contentId, $stateGroupId);
            $cache->set($contentState->id)->save();
            return $contentState;
        }
        return $this->load($stateId);
    }