Beispiel #1
0
 private function insertProfesional()
 {
     if ($this->get_request_method() != "POST") {
         $this->response('', 406);
     }
     $fechaMatriculacion = DateTime::createFromFormat("d/m/Y", $this->_request['fechaMatriculacion']);
     $profesional = new profesional($this->_request['matricula'], $this->_request['apellido'], $this->_request['nombres'], $this->_request['email'], $fechaMatriculacion, $this->_request['tipoProfesion'], $this->_request['ambito'], $this->_request['estado']);
     $pdoProfesionales = new ProfesionalPDO();
     $rowsAfected = 0;
     $rowsAfected = $pdoProfesionales->insert($profesional);
     //retorno resultado operacion
     if ($rowsAfected == 1) {
         $result = array('status' => "Success", "msg" => "El Profesional ha sido AGREGADO Correctamente");
         $this->response($this->json($result), 200);
     } else {
         $result = array('status' => "error", "msg" => "Error, no one record afected.");
         $this->response($this->json($result), 200);
     }
 }
Beispiel #2
0
<?php

date_default_timezone_set('UTC');
include '../class/ProfesionalPDO.php';
//include 'class/Profesional.php';
$pdo = new ProfesionalPDO();
echo "<h3>====== TEST insert() Profesional =====</h3>";
$unProfesional = new Profesional("aa-0001", "addd", "adad", "*****@*****.**", DateTime::createFromFormat("Y-m-d", "1987-10-23"), "Clinico", "n", 1);
echo "<br>";
print_r($unProfesional);
$pdo->insert($unProfesional);