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

loadObjectStates() public method

See also: eZ\Publish\SPI\Persistence\Content\ObjectState\Handler::loadObjectStates
public loadObjectStates ( $groupId )
    public function loadObjectStates($groupId)
    {
        $cache = $this->cache->getItem('objectstate', 'byGroup', $groupId);
        $objectStateIds = $cache->get();
        if ($cache->isMiss()) {
            $this->logger->logCall(__METHOD__, array('groupId' => $groupId));
            $objectStates = $this->persistenceHandler->objectStateHandler()->loadObjectStates($groupId);
            $objectStateIds = array();
            foreach ($objectStates as $objectState) {
                $objectStateIds[] = $objectState->id;
            }
            $cache->set($objectStateIds)->save();
        } else {
            $objectStates = array();
            foreach ($objectStateIds as $stateId) {
                $objectStates[] = $this->load($stateId);
            }
        }
        return $objectStates;
    }