parent
6c959134ee
commit
3b40d81a0d
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
class SexeGateway
|
||||
{
|
||||
private $con;
|
||||
|
||||
function __construct(Connection $con) {
|
||||
$this->con = $con;
|
||||
}
|
||||
|
||||
public function getFromId(int $id): array
|
||||
{
|
||||
$this->con->executeQuery("SELECT id, libelle FROM Sexe WHERE id=:id;",
|
||||
[':id' => [$id, $this->con::PARAM_INT]]);
|
||||
return $this->con->getOneResult();
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
class MdlSexe extends MdlBase{
|
||||
private SexeGateway $gw;
|
||||
|
||||
public function __construct(){
|
||||
parent::__construct();
|
||||
$this->gw = new SexeGateway($this->con);
|
||||
}
|
||||
|
||||
public function getFromId(int $id): Sexe{
|
||||
$row = $this->gw->getFromId($id);
|
||||
return new Sexe($row['id'], $row['libelle']);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace model;
|
||||
|
||||
class Sexe
|
||||
{
|
||||
private int $id;
|
||||
private string $libelle;
|
||||
|
||||
public function __construct(int $id, string $libelle)
|
||||
{
|
||||
$this->id=$id;
|
||||
$this->libelle=$libelle;
|
||||
}
|
||||
|
||||
public function getId():int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getLibelle(): string
|
||||
{
|
||||
return $this->libelle;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue