/** * Create an array of Images associated with this Pet instance * @throws Exception */ public function loadImages() { $petId = 'pet:' . $this->id; $res = Model\Image::getImagesByPetId($petId); if ($res === false) { // log errors $msg = Core\Db::getErrorMessage(); error_log("\n" . date('Y-m-d H:i:s', time()) . ": " . $msg, 3, LOG_PATH . '/mysql_error_log'); throw new Exception($msg); } $this->images = array(); foreach ($res as $imageRow) { $this->images[] = Image::constructByRow($imageRow); } }