public function addCategory(\model\Category $c) { $smt = $this->conn->prepare("INSERT INTO " . self::$table . " (\n\t\t\t\t\t\t\t\t\t" . self::$c_name . ", \n\t\t\t\t\t\t\t\t\t" . self::$c_level . ") \n\t\t\t\t\t\t\t\t\t\tVALUES ('" . $c->getCategoryName() . "', \n\t\t\t\t\t\t\t\t\t\t\t'" . $c->getLevel() . "')"); $smt->execute(); }
/** * Method for creating a category * @param \model\Category $c */ public function createCategory(\model\Category $c) { if ($this->categoryDAL->checkCategoryExists($c->getCategoryName())) { throw new \PDOCategoryExistsException("Category name already exists in database."); } $this->categoryDAL->addCategory($c); }