Ejemplo n.º 1
0
 public function __invoke($cursor)
 {
     $collection = new Collection();
     foreach ($cursor as $document) {
         $collection->add($this->resource_hydrator->__invoke($document));
     }
     return $collection;
 }
Ejemplo n.º 2
0
 public function __invoke($requested_page, $photos_per_page)
 {
     $photos = $this->database_handler->getCollection('photo');
     $photos = array_slice($photos, ($requested_page - 1) * $photos_per_page);
     $photo_collection = new PhotoCollection();
     foreach ($photos as $poto) {
         $photo_collection->add($poto);
     }
     return $photo_collection;
 }