Exemplo n.º 1
0
 /**
  * Returns the object with the (internal) identifier, if it is known to the
  * backend. Otherwise NULL is returned.
  *
  * @param string $identifier
  * @param string $className
  * @return object|NULL The object for the identifier if it is known, or NULL
  */
 public function getObjectByIdentifier($identifier, $className)
 {
     if ($this->session->hasIdentifier($identifier, $className)) {
         return $this->session->getObjectByIdentifier($identifier, $className);
     } else {
         $query = $this->persistenceManager->createQueryForType($className);
         $query->getQuerySettings()->setRespectStoragePage(false);
         $query->getQuerySettings()->setRespectSysLanguage(false);
         return $query->matching($query->equals('uid', $identifier))->execute()->getFirst();
     }
 }
Exemplo n.º 2
0
 /**
  * Returns a query for objects of this repository
  *
  * @return \TYPO3\CMS\Extbase\Persistence\QueryInterface
  * @api
  */
 public function createQuery()
 {
     $query = $this->persistenceManager->createQueryForType($this->objectType);
     if ($this->defaultOrderings !== array()) {
         $query->setOrderings($this->defaultOrderings);
     }
     if ($this->defaultQuerySettings !== NULL) {
         $query->setQuerySettings(clone $this->defaultQuerySettings);
     }
     return $query;
 }