1 | <?php |
2 | |
3 | require_once __DIR__ . "/../../lib/php/recibeFetchAll.php"; |
4 | require_once __DIR__ . "/../modelo/Rol.php"; |
5 | require_once __DIR__ . "/Bd.php"; |
6 | |
7 | |
8 | function usuRolConsulta(int $usuId) |
9 | { |
10 | $con = Bd::getConexion(); |
11 | $stmt = $con->query( |
12 | "SELECT |
13 | UR.ROL_ID AS id, |
14 | R.ROL_DESCRIPCION AS descripcion |
15 | FROM USU_ROL UR, ROL R |
16 | WHERE |
17 | UR.ROL_ID = R.ROL_ID |
18 | AND UR.USU_ID = :usuId |
19 | ORDER BY UR.ROL_ID" |
20 | ); |
21 | $stmt->execute([":usuId" => $usuId]); |
22 | $resultado = $stmt->fetchAll( |
23 | PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, |
24 | Rol::class |
25 | ); |
26 | return recibeFetchAll($resultado); |
27 | } |
28 | |