Commit a77548f99e656dc6e7ff9d46d970749c993566a7
1 parent
a6aec719
registration
Showing
1 changed file
with
17 additions
and
4 deletions
Show diff stats
app/library/App/Controllers/UserController.php
... | ... | @@ -52,12 +52,25 @@ class UserController extends CrudResourceController |
52 | 52 | |
53 | 53 | $data = $this->transformPostData($data); |
54 | 54 | |
55 | - //$item = $this->createModelInstance(); | |
56 | - $item = new User(); | |
55 | + $item = $this->createModelInstance(); | |
57 | 56 | |
58 | - die(var_dump($item)); | |
57 | + //$newItem = $this->createItem($item, $data); | |
58 | + $this->beforeAssignData($item, $data); | |
59 | + $item->assign($data, null, $this->whitelistCreate()); | |
60 | + $this->afterAssignData($item, $data); | |
59 | 61 | |
60 | - $newItem = $this->createItem($item, $data); | |
62 | + $this->beforeSave($item); | |
63 | + $this->beforeCreate($item); | |
64 | + | |
65 | + $success = $item->create(); | |
66 | + | |
67 | + if ($success) { | |
68 | + | |
69 | + $this->afterCreate($item); | |
70 | + $this->afterSave($item); | |
71 | + } | |
72 | + | |
73 | + $newItem = $success ? $item : null; | |
61 | 74 | |
62 | 75 | if (!$newItem) { |
63 | 76 | return $this->onCreateFailed($item, $data); | ... | ... |