Ejemplo n.º 1
0
Archivo: Api.php Proyecto: c15k0/psfs
 /**
  * Modify {__API__} model
  *
  * @PUT
  * @PAYLOAD {__API__}
  * @ROUTE /api/{__API__}/{pk}
  *
  * @param string $pk
  *
  * @return \PSFS\base\dto\JsonResponse(data={__API__})
  *
  */
 public function put($pk)
 {
     $this->hydrateModel($pk);
     $status = 400;
     $updated = FALSE;
     $model = NULL;
     if (NULL !== $this->model) {
         $this->con->beginTransaction();
         $this->model->fromArray($this->data);
         if ($this->model->save($this->con) !== FALSE) {
             $updated = TRUE;
             $status = 200;
             $model = $this->model->toArray();
         }
     }
     return $this->json(new JsonResponse($model, $updated), $status);
 }
Ejemplo n.º 2
0
 public function save(ActiveRecordInterface $record)
 {
     $record->save();
 }