Ejemplo n.º 1
0
 /**
  * @param SwiftObject $object
  *
  * @throws SwiftException
  *
  * @return bool
  *
  * @see DriverInterface::updateObject()
  */
 public function updateObject(SwiftObject $object)
 {
     if (is_null($object->getLocalFile()) && !$this->objectExists($object)) {
         throw new SwiftException('Cannot update a new object without a body');
     }
     return $this->driver->updateObject($object);
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function updateObject(SwiftObject $object)
 {
     // persist container
     $this->updateContainer($object->getContainer());
     // see if local file is specified
     if (is_null($object->getLocalFile())) {
         // just update the headers
         return $this->updateObjectMetadata($object);
     }
     // timestamp the object
     $object->setLastModifiedDate(new \DateTime());
     $this->logger->info(sprintf('Updating object "%s"', $object->getPath()));
     $response = $this->put($object->getPath(), null, $object->getUpdateHeaders(), $object->getBody());
     return $this->assertResponse($response, [201 => true]);
 }