30 $sql =
"SELECT * FROM role";
31 $pdoStatement = $this->pdo->prepare($sql);
32 $pdoStatement->execute();
33 $pdoStatement->setFetchMode(PDO::FETCH_ASSOC);
34 $tableau = $pdoStatement->fetchAll();
41 $sql =
"SELECT * FROM role WHERE idRole = :id";
42 $pdoStatement = $this->pdo->prepare($sql);
43 $pdoStatement->execute(array(
47 $pdoStatement->setFetchMode(PDO::FETCH_ASSOC);
48 $tableau = $pdoStatement->fetch();
49 $role = $this->
hydrate($tableau);
55 $sql =
"SELECT * FROM role WHERE typeRole = :typeRole LIMIT 1";
56 $pdoStatement = $this->pdo->prepare($sql);
57 $pdoStatement->execute([
58 ':typeRole' => $typeRole
60 $pdoStatement->setFetchMode(PDO::FETCH_ASSOC);
61 $tableau = $pdoStatement->fetch();
67 return $this->
hydrate($tableau);
73 $role->setIdRole(isset($tableaAssoc[
'idRole']) ? (
int)$tableaAssoc[
'idRole'] :
null);
74 $role->setTypeRole($tableaAssoc[
'typeRole'] ??
null);
75 $role->setLibelleRole($tableaAssoc[
'libelleRole'] ??
null);
82 foreach ($tableauxAssoc as $tableauAssoc) {
83 $roles[] = $this->
hydrate($tableauAssoc);
hydrate(array $tableaAssoc)
__construct(?PDO $pdo=null)
Constructeur de la classe RoleDAO.
findAll()
Récupère tous les rôles de la base de données.
hydrateMany(array $tableauxAssoc)
findByType(string $typeRole)