示例#1
0
 public function isSame(\model\Beer $other)
 {
     return $this->id === $other->getId();
 }
示例#2
0
 /**
  * Updates a post in the table beers
  *
  * @param Beer $beer
  * @throws \DataBaseException
  * @throws \Exception
  */
 public function updateBeer(\model\Beer $beer)
 {
     try {
         $stmt = $this->conn->prepare("CALL update_beer(?, ?, ?, ?, ?, ?, ?, ?)");
         if (!$stmt) {
             throw new \DataBaseException($this->conn->error);
         }
         $id = $beer->getId();
         $name = $beer->getName();
         $abv = $beer->getAbv();
         $manufacturer = $beer->getBrewery();
         $imageurl = $beer->getImageURL();
         $country = $beer->getCountry();
         $volume = $beer->getVolume();
         $servingType = $beer->getServingType();
         $stmt->bind_param("ssdsssds", $id, $name, $abv, $manufacturer, $imageurl, $country, $volume, $servingType);
         $stmt->execute();
     } catch (\DataBaseException $e) {
         if (\Settings::DEBUG_MODE) {
             throw $e;
         } else {
             error_log($e->getMessage() . "\n", 3, \Settings::ERROR_LOG);
             echo "Something went wrong when connecting to the database";
             die;
         }
     }
 }