public function __call($ps_table, $pa_args)
 {
     $vo_service = new ModelService($this->request, $ps_table);
     $va_content = $vo_service->dispatch();
     if (intval($this->request->getParameter("pretty", pInteger)) > 0) {
         $this->view->setVar("pretty_print", true);
     }
     if ($vo_service->hasErrors()) {
         $this->view->setVar("errors", $vo_service->getErrors());
         $this->render("json_error.php");
     } else {
         $this->view->setVar("content", $va_content);
         $this->render("json.php");
     }
 }
 public function modelToResource($patient)
 {
     $res = parent::modelToResource($patient);
     $res->nhs_num = $patient->nhs_num;
     $res->hos_num = $patient->hos_num;
     $res->title = $patient->contact->title;
     $res->family_name = $patient->contact->last_name;
     $res->given_name = $patient->contact->first_name;
     $res->gender = $patient->gender;
     $res->birth_date = $patient->dob;
     $res->date_of_death = $patient->date_of_death;
     $res->primary_phone = $patient->contact->primary_phone;
     $res->addresses = array_map(array('services\\PatientAddress', 'fromModel'), $patient->contact->addresses);
     if ($patient->gp_id) {
         $res->gp_ref = new InternalReference('Gp', $patient->gp_id);
     }
     if ($patient->practice_id) {
         $res->prac_ref = new InternalReference('Practice', $patient->practice_id);
     }
     foreach ($patient->commissioningbodies as $cb) {
         $res->cb_refs[] = new InternalReference('CommissioningBody', $cb->id);
     }
     $res->care_providers = array_merge(array_filter(array($res->gp_ref, $res->prac_ref)), $res->cb_refs);
     return $res;
 }
Beispiel #3
0
 public function modelToResource($practice)
 {
     $res = parent::modelToResource($practice);
     $res->code = $practice->code;
     $res->primary_phone = $practice->phone;
     if ($practice->contact->address) {
         $res->address = Address::fromModel($practice->contact->address);
     }
     return $res;
 }
 public function modelToResource($cb)
 {
     $res = parent::modelToResource($cb);
     $res->code = $cb->code;
     $res->name = $cb->name;
     if ($cb->contact->address) {
         $res->address = Address::fromModel($cb->contact->address);
     }
     return $res;
 }
Beispiel #5
0
 public function modelToResource($gp)
 {
     $res = parent::modelToResource($gp);
     $res->gnc = $gp->nat_id;
     $res->title = $gp->contact->title;
     $res->family_name = $gp->contact->last_name;
     $res->given_name = $gp->contact->first_name;
     $res->primary_phone = $gp->contact->primary_phone ?: null;
     if ($gp->contact->address) {
         $resouce->address = Address::fromModel($gp->contact->address);
     }
     return $res;
 }
Beispiel #6
0
 public function __destruct()
 {
     parent::__destruct();
 }
Beispiel #7
0
 /**
  *
  */
 function test_view()
 {
     $service = new ModelService();
     $this->assertInstanceOf(Mvc5Model::class, $service->view('foo', ['foo']));
 }
 public function __construct()
 {
     self::$connect = DBConnection::getConnection($connector = new DBPostgreSQLService());
 }