projet-php/toBDD.php

30 lines
943 B
PHP
Executable File

<?php
/**
* Created by PhpStorm.
* User: seekdasky
* Date: 03/12/15
* Time: 11:52
*/
require_once('autoloader.php');
$jsonP = json_decode(file_get_contents('Docs/PatientExemple.json'),true);
$jsonM = json_decode(file_get_contents('Docs/MedecinExemple.json'),true);
$jsonR = json_decode(file_get_contents('Docs/RDVExemple.json'),true);
var_dump(StaticRepo::testConnexion());
$repo = new PatientRepo();
$repoM = new MedecinRepo();
foreach($jsonM as $patient) {
$repoM->add($patient['Civilite'], $patient['Prenom'], $patient['Nom']);
}
foreach($jsonP as $patient){
$repo->add($patient['Civilite'],$patient['Prenom'],$patient['Nom'],$patient['Adresse'],NULL,$patient['Ville'],$patient['CodePostal'],$patient['DateNaissance'],$patient['LieuNaissance'],$patient['NumSecuriteSociale'],$patient['MedecinTraitant']);
}
foreach($jsonR as $rdv){
RDVRepo::add($rdv['DateRDV'],$rdv['Duree'],$rdv['Patient_Id'],$rdv['Medecin_Id']);
}