Ejemplo n.º 1
0
 public function __invoke(Id $id)
 {
     $query = new Query(['_id' => $id->value()]);
     $cursor = $this->mongo->executeQuery('booothy.photo', $query)->toArray();
     if (empty($cursor)) {
         throw new NonExistingResource();
     }
     return $this->hydrator->__invoke($cursor[0]);
 }
Ejemplo n.º 2
0
 public static function generateNew($a_quote, $an_upload_mime_type, Email $an_email)
 {
     $id = Id::next();
     $quote = new Quote($a_quote);
     $creation_date = new DateTimeImmutable();
     $image_details = ImageDetails::fake();
     $upload = self::generateUpload($a_quote, $creation_date, $an_upload_mime_type);
     return new self($id, $quote, $upload, $image_details, $creation_date, $an_email);
 }
Ejemplo n.º 3
0
 public function __invoke(Id $id)
 {
     return $this->database_handler->getResource('photo', $id->value(), function () {
         throw new NonExistingResource();
     });
 }