/**
  * Retrieves all revisions for the current objet
  *
  * @param callable $callback Optional object callback.
  * @return array
  */
 public function allRevisions(callable $callback = null)
 {
     $loader = new CollectionLoader(['logger' => $this->logger, 'factory' => $this->modelFactory()]);
     $loader->setModel($this->createRevisionObject());
     $loader->addFilter('target_type', $this->objType());
     $loader->addFilter('target_id', $this->id());
     $loader->addOrder('rev_ts', 'desc');
     if ($callback !== null) {
         $loader->setCallback($callback);
     }
     $revisions = $loader->load();
     return $revisions->objects();
 }
 /**
  * Return all the objs with geographical information
  *
  * @return Collection
  */
 public function mapObjects()
 {
     if ($this->mapObjects === null) {
         $loader = new CollectionLoader(['logger' => $this->logger, 'factory' => $this->modelFactory()]);
         $loader->setModel($this->objProto());
         $that = $this;
         $loader->setCallback(function ($obj) use($that) {
             $obj->mapInfoboxTemplate = $that->infoboxTemplate();
             if ($that->latProperty() && $that->latProperty()) {
                 $obj->mapShowMarker = true;
                 $obj->mapLat = call_user_func([$obj, $that->latProperty()]);
                 $obj->mapLon = call_user_func([$obj, $that->lonProperty()]);
             } else {
                 $obj->mapShowMarker = false;
             }
             if ($that->pathProperty()) {
                 $mapPath = call_user_func([$obj, $that->pathProperty()]);
                 if ($mapPath) {
                     $obj->mapShowPath = true;
                     // Same type of coords.
                     $obj->mapPath = $that->formatPolygon($mapPath);
                 } else {
                     $obj->mapShowPath = false;
                 }
             }
             if ($that->polygonProperty()) {
                 $mapPolygon = call_user_func([$obj, $that->polygonProperty()]);
                 if ($mapPolygon) {
                     $obj->mapShowPolygon = true;
                     $obj->mapPolygon = $that->formatPolygon($mapPolygon);
                 } else {
                     $obj->mapShowPolygon = false;
                 }
             }
         });
         $this->mapObjects = $loader->load();
     }
     foreach ($this->mapObjects as $obj) {
         $GLOBALS['widget_template'] = $obj->mapInfoboxTemplate;
         (yield $obj);
     }
 }