Commit 30944c2d03507155c49e39cbc5db290492c3ffea
1 parent
d0e9f21e
registration
Showing
1 changed file
with
1 additions
and
47 deletions
Show diff stats
app/library/App/Controllers/UserController.php
| @@ -36,53 +36,7 @@ class UserController extends CrudResourceController | @@ -36,53 +36,7 @@ class UserController extends CrudResourceController | ||
| 36 | 36 | ||
| 37 | public function register() { | 37 | public function register() { |
| 38 | 38 | ||
| 39 | - $data = $this->getPostedData(); | ||
| 40 | - | ||
| 41 | - if (!$data || count($data) == 0) { | ||
| 42 | - return $this->onNoDataProvided(); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - if (!$this->postDataValid($data, false)) { | ||
| 46 | - return $this->onDataInvalid($data); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - if (!$this->saveAllowed($data) || !$this->createAllowed($data)) { | ||
| 50 | - return $this->onNotAllowed(); | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - $data = $this->transformPostData($data); | ||
| 54 | - | ||
| 55 | - $item = $this->createModelInstance(); | ||
| 56 | - | ||
| 57 | - //$newItem = $this->createItem($item, $data); | ||
| 58 | - $item->assign($data, null, $this->whitelistCreate()); | ||
| 59 | - $this->afterAssignData($item, $data); | ||
| 60 | - | ||
| 61 | - $this->beforeSave($item); | ||
| 62 | - $this->beforeCreate($item); | ||
| 63 | - | ||
| 64 | - $success = $item->create(); | ||
| 65 | - | ||
| 66 | - if ($success) { | ||
| 67 | - | ||
| 68 | - $this->afterCreate($item); | ||
| 69 | - $this->afterSave($item); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - $newItem = $success ? $item : null; | ||
| 73 | - | ||
| 74 | - if (!$newItem) { | ||
| 75 | - return $this->onCreateFailed($item, $data); | ||
| 76 | - } | ||
| 77 | - | ||
| 78 | - die(var_dump($newItem)); | ||
| 79 | - | ||
| 80 | - $primaryKey = $this->getModelPrimaryKey(); | ||
| 81 | - $responseData = $this->getFindData($newItem->$primaryKey); | ||
| 82 | - | ||
| 83 | - $response = $this->getCreateResponse($responseData, $data); | ||
| 84 | - | ||
| 85 | - return $response; | 39 | + parent::create(); |
| 86 | } | 40 | } |
| 87 | 41 | ||
| 88 | public function whitelist() | 42 | public function whitelist() |