Exemplo n.º 1
0
 /**
  * Adds an object to this repository.
  *
  * @param object $object The object to add
  * @return void
  * @throws \TYPO3\FLOW3\Persistence\Exception\IllegalObjectTypeException
  * @api
  */
 public function add($object)
 {
     if (!is_object($object) || !$object instanceof $this->entityClassName) {
         $type = is_object($object) ? get_class($object) : gettype($object);
         throw new \TYPO3\FLOW3\Persistence\Exception\IllegalObjectTypeException('The value given to add() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1298403438);
     }
     $this->persistenceManager->add($object);
 }
Exemplo n.º 2
0
 /**
  * Helper function which creates or fetches a resource pointer object for a given hash.
  *
  * If a ResourcePointer with the given hash exists, this one is used. Else, a new one
  * is created. This is a workaround for missing ValueObject support in Doctrine.
  *
  * @param string $hash
  * @return \TYPO3\FLOW3\Resource\ResourcePointer
  */
 public function getResourcePointerForHash($hash)
 {
     $resourcePointer = $this->persistenceManager->getObjectByIdentifier($hash, 'TYPO3\\FLOW3\\Resource\\ResourcePointer');
     if (!$resourcePointer) {
         $resourcePointer = new \TYPO3\FLOW3\Resource\ResourcePointer($hash);
         $this->persistenceManager->add($resourcePointer);
     }
     return $resourcePointer;
 }