/** * Modify the product name and ean in database by id. * It checks if the EAN already exists by another product, and does not overwrite. * * @param Product $product * @return bool */ public function modify(Product $product) { if ($this->checkUnique($product->getEan())) { $sth = $this->pdo->prepare("\n\t\t\t\tUPDATE product\n\t\t\t\tSET\n\t\t\t\t\tean = :_ean,\n\t\t\t\t\tname = :_name\n\t\t\t\tWHERE\n\t\t\t\t\tid = :_id\n\t\t\t"); return $sth->execute(array(':_id' => $product->getId(), ':_ean' => $product->getEan(), ':_name' => $product->getName())); } return false; }