Esempio n. 1
0
 /**
  * Fetch an object from persistence layer.
  *
  * @param mixed $identity
  * @param string $targetType
  * @throws \TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException
  * @throws \TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException
  * @return object
  */
 protected function fetchObjectFromPersistence($identity, $targetType)
 {
     if (ctype_digit((string) $identity)) {
         $object = $this->persistenceManager->getObjectByIdentifier($identity, $targetType);
     } else {
         throw new \TYPO3\CMS\Extbase\Property\Exception\InvalidSourceException('The identity property "' . $identity . '" is no UID.', 1297931020);
     }
     if ($object === null) {
         throw new \TYPO3\CMS\Extbase\Property\Exception\TargetNotFoundException(sprintf('Object of type %s with identity "%s" not found.', $targetType, print_r($identity, true)), 1297933823);
     }
     return $object;
 }
Esempio n. 2
0
 /**
  * Finds an object matching the given identifier.
  *
  * @param mixed $identifier The identifier of the object to find
  * @return object The matching object if found, otherwise NULL
  * @api
  */
 public function findByIdentifier($identifier)
 {
     return $this->persistenceManager->getObjectByIdentifier($identifier, $this->objectType);
 }
Esempio n. 3
0
 /**
  * @param CoreFileReference $falFileReference
  * @param int $resourcePointer
  * @return ExtbaseFileReference
  */
 protected function createFileReferenceFromFalFileReferenceObject(CoreFileReference $falFileReference, int $resourcePointer = null) : ExtbaseFileReference
 {
     if ($resourcePointer === null) {
         $fileReference = $this->objectManager->get(ExtbaseFileReference::class);
     } else {
         $fileReference = $this->persistenceManager->getObjectByIdentifier($resourcePointer, ExtbaseFileReference::class, false);
     }
     $fileReference->setOriginalResource($falFileReference);
     return $fileReference;
 }