smarty ça casse les couilles zebi
This commit is contained in:
parent
b1960b2f35
commit
aec3c845e0
469 changed files with 53465 additions and 69 deletions
47
models/category_model.php
Normal file
47
models/category_model.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
require_once('./config/database.php');
|
||||
|
||||
/**
|
||||
* Traitement des requêtes pour les catégories
|
||||
* @author : Laura
|
||||
*/
|
||||
|
||||
class CategoryModel extends Connect{
|
||||
|
||||
/**
|
||||
* Fonction de récupération des catégories
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public function findAllCategory(int $intLimit=0):array{
|
||||
|
||||
$strRq = "SELECT category.*
|
||||
FROM category";
|
||||
|
||||
if ($intLimit > 0){
|
||||
$strRq .= " LIMIT ".$intLimit;
|
||||
}
|
||||
|
||||
return $this->_db->query($strRq)->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* fonction d'insertion d'une nouvelle catégorie dans la bdd
|
||||
* @param object $objUser L'objet utilisateur
|
||||
* @return bool Est-ce que la requête s'est bien passée (true/false)
|
||||
*/
|
||||
|
||||
public function insert(object $objCategory):bool{
|
||||
|
||||
$strRq = "INSERT INTO category (category_name, category_parent)
|
||||
VALUES (:name, :parent)";
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
|
||||
$rqPrep->bindValue(":name", $objCategory->getName(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":parent", $objCategory->getParent(), PDO::PARAM_STR);
|
||||
|
||||
return $rqPrep->execute();
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue