getUpdatedDate() public method

Get the updated date
public getUpdatedDate ( ) : DateTime
return DateTime
コード例 #1
0
ファイル: ImageTest.php プロジェクト: imbo/imbo
 /**
  * @covers Imbo\Model\Image::setUpdatedDate
  * @covers Imbo\Model\Image::getUpdatedDate
  */
 public function testCanSetAndGetTheUpdatedDate()
 {
     $date = $this->getMock('DateTime');
     $this->assertNull($this->image->getUpdatedDate());
     $this->assertSame($this->image, $this->image->setUpdatedDate($date));
     $this->assertSame($date, $this->image->getUpdatedDate());
 }
コード例 #2
0
ファイル: MongoDB.php プロジェクト: ASP96/imbo
 /**
  * {@inheritdoc}
  */
 public function insertImage($publicKey, $imageIdentifier, Image $image)
 {
     $now = time();
     if ($added = $image->getAddedDate()) {
         $added = $added->getTimestamp();
     }
     if ($updated = $image->getUpdatedDate()) {
         $updated = $updated->getTimestamp();
     }
     if ($this->imageExists($publicKey, $imageIdentifier)) {
         try {
             $this->getImageCollection()->update(['publicKey' => $publicKey, 'imageIdentifier' => $imageIdentifier], ['$set' => ['updated' => $now]], ['multiple' => false]);
             return true;
         } catch (MongoException $e) {
             throw new DatabaseException('Unable to save image data', 500, $e);
         }
     }
     $data = ['size' => $image->getFilesize(), 'publicKey' => $publicKey, 'imageIdentifier' => $imageIdentifier, 'extension' => $image->getExtension(), 'mime' => $image->getMimeType(), 'metadata' => [], 'added' => $added ?: $now, 'updated' => $updated ?: $now, 'width' => $image->getWidth(), 'height' => $image->getHeight(), 'checksum' => $image->getChecksum(), 'originalChecksum' => $image->getOriginalChecksum()];
     try {
         $this->getImageCollection()->insert($data);
     } catch (MongoException $e) {
         throw new DatabaseException('Unable to save image data', 500, $e);
     }
     return true;
 }
コード例 #3
0
ファイル: Doctrine.php プロジェクト: ASP96/imbo
 /**
  * {@inheritdoc}
  */
 public function insertImage($publicKey, $imageIdentifier, Image $image)
 {
     $now = time();
     if ($added = $image->getAddedDate()) {
         $added = $added->getTimestamp();
     }
     if ($updated = $image->getUpdatedDate()) {
         $updated = $updated->getTimestamp();
     }
     if ($id = $this->getImageId($publicKey, $imageIdentifier)) {
         return (bool) $this->getConnection()->update($this->tableNames['imageinfo'], array('updated' => $now), array('id' => $id));
     }
     return (bool) $this->getConnection()->insert($this->tableNames['imageinfo'], array('size' => $image->getFilesize(), 'publicKey' => $publicKey, 'imageIdentifier' => $imageIdentifier, 'extension' => $image->getExtension(), 'mime' => $image->getMimeType(), 'added' => $added ?: $now, 'updated' => $updated ?: $now, 'width' => $image->getWidth(), 'height' => $image->getHeight(), 'checksum' => $image->getChecksum(), 'originalChecksum' => $image->getOriginalChecksum()));
 }