/**
  * Schedules a modified object for persistence.
  *
  * @param object $object The modified object
  * @return void
  * @throws IllegalObjectTypeException
  * @api
  */
 public function update($object)
 {
     if (!$object instanceof $this->objectType) {
         throw new IllegalObjectTypeException('The modified object given to update() was not of the type (' . $this->objectType . ') this repository manages.', 1249479625);
     }
     $this->persistenceManager->update($object);
 }
 /**
  * Schedules a modified object for persistence.
  *
  * @param object $object The modified object
  * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException
  * @api
  */
 public function update($object)
 {
     if (!is_object($object) || !$object instanceof $this->entityClassName) {
         $type = is_object($object) ? get_class($object) : gettype($object);
         throw new \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException('The value given to update() was ' . $type . ' , however the ' . get_class($this) . ' can only store ' . $this->entityClassName . ' instances.', 1249479625);
     }
     $this->persistenceManager->update($object);
 }
 /**
  * Checks if a propertyValue contains an entity and persists it.
  *
  * @param mixed $propertyValue
  * @return void
  */
 protected function persistEntities($propertyValue)
 {
     if (!$propertyValue instanceof \Iterator && !is_array($propertyValue)) {
         $propertyValue = array($propertyValue);
     }
     foreach ($propertyValue as $possibleEntity) {
         if (is_object($possibleEntity) && $possibleEntity instanceof \TYPO3\Flow\Persistence\Aspect\PersistenceMagicInterface) {
             $this->persistenceManager->isNewObject($possibleEntity) ? $this->persistenceManager->add($possibleEntity) : $this->persistenceManager->update($possibleEntity);
             // TODO: Needed because the originalAsset will not cascade persist. We should find a generic solution to this.
             if ($possibleEntity instanceof ImageVariant) {
                 $asset = $possibleEntity->getOriginalAsset();
                 $this->persistenceManager->isNewObject($asset) ? $this->persistenceManager->add($asset) : $this->persistenceManager->update($asset);
             }
         }
     }
 }
 /**
  * Checks if a property value contains an entity and persists it.
  *
  * @param mixed $value
  */
 protected function persistRelatedEntities($value)
 {
     if (!is_array($value) && !$value instanceof \Iterator) {
         $value = array($value);
     }
     foreach ($value as $element) {
         if (is_object($element) && $element instanceof PersistenceMagicInterface) {
             $this->persistenceManager->isNewObject($element) ? $this->persistenceManager->add($element) : $this->persistenceManager->update($element);
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Updates the attached content object
  *
  * @param object $contentObject
  * @return void
  */
 protected function updateContentObject($contentObject)
 {
     $this->persistenceManager->update($contentObject);
 }