/** * @return int|string */ private function getLastImageId() { $images = new GalleryImages(); $res = $images->fetchRow($images->select()->where("albumid=?", $this->id)->order("time")->limit(1)); if ($res === null) { return 0; } else { return $res->id; } }