Commit a07c0bce14eecc6eceb8055450d323ec7280fe38
1 parent
5ad93ca6
test
Showing
1 changed file
with
18 additions
and
11 deletions
Show diff stats
app/library/App/Controllers/UserController.php
| ... | ... | @@ -46,6 +46,10 @@ class UserController extends CrudResourceController |
| 46 | 46 | |
| 47 | 47 | public function registration() { |
| 48 | 48 | |
| 49 | + $this->beforeHandle(); | |
| 50 | + $this->beforeHandleWrite(); | |
| 51 | + $this->beforeHandleCreate(); | |
| 52 | + | |
| 49 | 53 | $data = $this->getPostedData(); |
| 50 | 54 | |
| 51 | 55 | if (!$data || count($data) == 0) { |
| ... | ... | @@ -62,15 +66,9 @@ class UserController extends CrudResourceController |
| 62 | 66 | |
| 63 | 67 | $data = $this->transformPostData($data); |
| 64 | 68 | |
| 65 | -// $user = new User(); | |
| 66 | -// $user->name = $data['name']; | |
| 67 | -// $user->pass = $data['pass']; | |
| 68 | -// $user->save(); | |
| 69 | - | |
| 70 | 69 | $item = $this->createModelInstance(); |
| 71 | - die(var_dump($item)); | |
| 70 | + | |
| 72 | 71 | $newItem = $this->createItem($item, $data); |
| 73 | - die(var_dump($newItem)); | |
| 74 | 72 | |
| 75 | 73 | if (!$newItem) { |
| 76 | 74 | return $this->onCreateFailed($item, $data); |
| ... | ... | @@ -81,8 +79,17 @@ class UserController extends CrudResourceController |
| 81 | 79 | |
| 82 | 80 | $response = $this->getCreateResponse($responseData, $data); |
| 83 | 81 | |
| 82 | + $this->afterHandleCreate($newItem, $data, $response); | |
| 83 | + $this->afterHandleWrite(); | |
| 84 | + $this->afterHandle(); | |
| 85 | + | |
| 84 | 86 | return $response; |
| 85 | 87 | |
| 88 | +// $user = new User(); | |
| 89 | +// $user->name = $data['name']; | |
| 90 | +// $user->pass = $data['pass']; | |
| 91 | +// $user->save(); | |
| 92 | + | |
| 86 | 93 | } |
| 87 | 94 | |
| 88 | 95 | protected function transformPostDataValue($key, $value, $data) |
| ... | ... | @@ -98,9 +105,9 @@ class UserController extends CrudResourceController |
| 98 | 105 | /** |
| 99 | 106 | * fix phql for PG |
| 100 | 107 | */ |
| 101 | - protected function getModelPrimaryKey() | |
| 102 | - { | |
| 103 | - return 'id'; | |
| 104 | - } | |
| 108 | +// protected function getModelPrimaryKey() | |
| 109 | +// { | |
| 110 | +// return 'id'; | |
| 111 | +// } | |
| 105 | 112 | |
| 106 | 113 | } | ... | ... |