Neos\Flow\ObjectManagement\ObjectManagerInterface::getScope PHP Méthode

getScope() public méthode

Returns the scope of the specified object.
public getScope ( string $objectName ) : integer
$objectName string The object name
Résultat integer One of the Configuration::SCOPE_ constants
    public function getScope($objectName);

Usage Example

 /**
  * Resumes an existing session, if any.
  *
  * @return integer If a session was resumed, the inactivity of since the last request is returned
  * @api
  */
 public function resume()
 {
     if ($this->started === false && $this->canBeResumed()) {
         $this->sessionIdentifier = $this->sessionCookie->getValue();
         $this->response->setCookie($this->sessionCookie);
         $this->started = true;
         $sessionObjects = $this->storageCache->get($this->storageIdentifier . md5('TYPO3_Flow_Object_ObjectManager'));
         if (is_array($sessionObjects)) {
             foreach ($sessionObjects as $object) {
                 if ($object instanceof ProxyInterface) {
                     $objectName = $this->objectManager->getObjectNameByClassName(get_class($object));
                     if ($this->objectManager->getScope($objectName) === ObjectConfiguration::SCOPE_SESSION) {
                         $this->objectManager->setInstance($objectName, $object);
                         $this->objectManager->get(Aspect\LazyLoadingAspect::class)->registerSessionInstance($objectName, $object);
                     }
                 }
             }
         } else {
             // Fallback for some malformed session data, if it is no array but something else.
             // In this case, we reset all session objects (graceful degradation).
             $this->storageCache->set($this->storageIdentifier . md5('TYPO3_Flow_Object_ObjectManager'), [], [$this->storageIdentifier], 0);
         }
         $lastActivitySecondsAgo = $this->now - $this->lastActivityTimestamp;
         $this->lastActivityTimestamp = $this->now;
         return $lastActivitySecondsAgo;
     }
 }
All Usage Examples Of Neos\Flow\ObjectManagement\ObjectManagerInterface::getScope