Commit 931897148cd2837c43633511056adcfa3432dc7b
1 parent
c7a1a5b3
test
Showing
2 changed files
with
13 additions
and
17 deletions
Show diff stats
app/library/App/Controllers/UserController.php
@@ -66,11 +66,6 @@ class UserController extends CrudResourceController | @@ -66,11 +66,6 @@ class UserController extends CrudResourceController | ||
66 | 66 | ||
67 | $data = $this->transformPostData($data); | 67 | $data = $this->transformPostData($data); |
68 | 68 | ||
69 | - | ||
70 | - //$item = $this->createModelInstance(); | ||
71 | - | ||
72 | - //$newItem = $this->createItem($item, $data); | ||
73 | - | ||
74 | $newItem = new User(); | 69 | $newItem = new User(); |
75 | $map = $newItem->columnMap(); | 70 | $map = $newItem->columnMap(); |
76 | foreach ($data as $key => $value) { | 71 | foreach ($data as $key => $value) { |
@@ -86,8 +81,6 @@ class UserController extends CrudResourceController | @@ -86,8 +81,6 @@ class UserController extends CrudResourceController | ||
86 | 81 | ||
87 | $last_id = $newItem->getWriteConnection()->lastInsertId(); | 82 | $last_id = $newItem->getWriteConnection()->lastInsertId(); |
88 | 83 | ||
89 | - //$primaryKey = $this->getModelPrimaryKey(); | ||
90 | - | ||
91 | $responseData = $this->getFindData($last_id); | 84 | $responseData = $this->getFindData($last_id); |
92 | $response = $this->getCreateResponse($responseData, $data); | 85 | $response = $this->getCreateResponse($responseData, $data); |
93 | 86 | ||
@@ -99,9 +92,20 @@ class UserController extends CrudResourceController | @@ -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 | protected function transformPostDataValue($key, $value, $data) | 106 | protected function transformPostDataValue($key, $value, $data) |
103 | { | 107 | { |
104 | - if ($key == 'password') { | 108 | + if ($key == 'pass') { |
105 | return $this->security->hash($value); | 109 | return $this->security->hash($value); |
106 | } | 110 | } |
107 | else { | 111 | else { |
@@ -109,12 +113,4 @@ class UserController extends CrudResourceController | @@ -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,6 +11,6 @@ class UserTransformer extends ModelTransformer | ||
11 | 11 | ||
12 | protected function excludedProperties() | 12 | protected function excludedProperties() |
13 | { | 13 | { |
14 | - return ['password']; | 14 | + return ['pass']; |
15 | } | 15 | } |
16 | } | 16 | } |
17 | \ No newline at end of file | 17 | \ No newline at end of file |