mise en place des repo + définition des fonctions + début d'implémentation

This commit is contained in:
Lucas Mascaro 2015-12-02 13:31:37 +01:00
parent a78bbc29a1
commit b3d87e4664
5 changed files with 159 additions and 1 deletions

View File

@ -13,7 +13,7 @@ function autoloader($class) {
if(strpos($class, 'StaticRepo') !== FALSE){
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'repositories'.DIRECTORY_SEPARATOR.$class . '.php';
}
//si on charge un Repo
//si on charge un repos
elseif(strpos($class, 'Repo') !== FALSE){
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'repositories'.DIRECTORY_SEPARATOR.'repos'.DIRECTORY_SEPARATOR.$class . '.php';

View File

@ -0,0 +1,40 @@
<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 02/12/15
* Time: 12:36
*/
class MedecinRepo
{
private $connexion;
public function __construct(){
$this->connexion = StaticRepo::getConnexion();
}
public function getById($id){
$req = $this->connexion->prepare('SELECT * FROM Medecin WHERE Id = :id');
$req->execute(['id' => $id]);
return $req->fetchAll();
}
public function add($civilite,$prenom,$nom){
}
public function delete($idPatient){
}
public function search($nom,$prenom){
}
public function getPatients($idMedecin){
}
}

View File

@ -0,0 +1,52 @@
<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 02/12/15
* Time: 12:36
*/
class PatientRepo
{
private $connexion;
public function __construct(){
$this->connexion = StaticRepo::getConnexion();
}
public function getById($id){
$req = $this->connexion->prepare('SELECT * FROM Patient WHERE Id = :id');
$req->execute(['id' => $id]);
return $req->fetchAll();
}
public function add($civilite,$prenom,$nom,$adresse,$ville,$codePostal,$dateNaissance,$lieuNaissance,$numSecu,$medecinTraitant = null){
$req = $this->connexion->prepare('INSERT INTO Patient VALUES (:civilite,:nom,:prenom,:adresse,:ville,:codePostal,:dateNaissance,:lieuNaissance,:numSecu,DEFAULT,:medecin)');
$req->execute(['civilite' => $civilite,
'nom' => $nom,
'prenom' => $prenom,
'adresse' => $adresse,
'ville' => $ville,
'codePostal' => $codePostal,
'dateNaissance' => $dateNaissance,
'lieuNaissance' => $lieuNaissance,
'numSecu' => $numSecu,
'medecin' => $medecinTraitant ]);
}
public function delete($idPatient){
}
public function updateMedecinTraitant($idPatient,$IdMedecin){
}
public function search($nom,$prenom){
}
}

View File

@ -0,0 +1,44 @@
<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 02/12/15
* Time: 12:36
*/
class RDVRepo
{
private $connexion;
public function __construct(){
$this->connexion = StaticRepo::getConnexion();
}
public function getById($id){
$req = $this->connexion->prepare('SELECT * FROM RDV WHERE Id = :id');
$req->execute(['id' => $id]);
return $req->fetchAll();
}
public function getByDate($date){
}
public function delete($idPatient){
}
public function add($timestamp,$duree,$idPatient,$idMedecin){
}
public function updateDateTime($idRDV,$dateTime){
}
public function getByPatientAndDate($idPatient,$date){
}
}

View File

@ -0,0 +1,22 @@
<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 02/12/15
* Time: 12:36
*/
class StatsRepo
{
private $connexion;
public function __construct(){
$this->connexion = StaticRepo::getConnexion();
}
public function getStats(){
}
}