Commit 931897148cd2837c43633511056adcfa3432dc7b

Authored by Alex Savenko
1 parent c7a1a5b3

test

app/library/App/Controllers/UserController.php
... ... @@ -66,11 +66,6 @@ class UserController extends CrudResourceController
66 66  
67 67 $data = $this->transformPostData($data);
68 68  
69   -
70   - //$item = $this->createModelInstance();
71   -
72   - //$newItem = $this->createItem($item, $data);
73   -
74 69 $newItem = new User();
75 70 $map = $newItem->columnMap();
76 71 foreach ($data as $key => $value) {
... ... @@ -86,8 +81,6 @@ class UserController extends CrudResourceController
86 81  
87 82 $last_id = $newItem->getWriteConnection()->lastInsertId();
88 83  
89   - //$primaryKey = $this->getModelPrimaryKey();
90   -
91 84 $responseData = $this->getFindData($last_id);
92 85 $response = $this->getCreateResponse($responseData, $data);
93 86  
... ... @@ -99,9 +92,20 @@ class UserController extends CrudResourceController
99 92  
100 93 }
101 94  
  95 +// protected function transformPostData($data)
  96 +// {
  97 +// $result = [];
  98 +//
  99 +// foreach ($data as $key => $value) {
  100 +// $result[$key] = $this->transformPostDataValue($key, $value, $data);
  101 +// }
  102 +//
  103 +// return $result;
  104 +// }
  105 +
102 106 protected function transformPostDataValue($key, $value, $data)
103 107 {
104   - if ($key == 'password') {
  108 + if ($key == 'pass') {
105 109 return $this->security->hash($value);
106 110 }
107 111 else {
... ... @@ -109,12 +113,4 @@ class UserController extends CrudResourceController
109 113 }
110 114 }
111 115  
112   - /**
113   - * fix phql for PG
114   - */
115   - protected function getModelPrimaryKey()
116   - {
117   - return 'id';
118   - }
119   -
120 116 }
... ...
app/library/App/Transformers/UserTransformer.php
... ... @@ -11,6 +11,6 @@ class UserTransformer extends ModelTransformer
11 11  
12 12 protected function excludedProperties()
13 13 {
14   - return ['password'];
  14 + return ['pass'];
15 15 }
16 16 }
17 17 \ No newline at end of file
... ...