From 0f3b39608f8a5654594d2237c0a33bdc137c9f28 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Feb 2017 20:20:35 +0200 Subject: [PATCH] test --- app/library/App/Controllers/UserController.php | 39 +-------------------------------------- app/library/App/Model/User.php | 17 ----------------- 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/app/library/App/Controllers/UserController.php b/app/library/App/Controllers/UserController.php index 684eadc..686a285 100755 --- a/app/library/App/Controllers/UserController.php +++ b/app/library/App/Controllers/UserController.php @@ -46,44 +46,7 @@ class UserController extends CrudResourceController public function registration() { - $this->beforeHandle(); - $this->beforeHandleWrite(); - $this->beforeHandleCreate(); - - $data = $this->getPostedData(); - - if (!$data || count($data) == 0) { - return $this->onNoDataProvided(); - } - - if (!$this->postDataValid($data, false)) { - return $this->onDataInvalid($data); - } - - if (!$this->saveAllowed($data) || !$this->createAllowed($data)) { - return $this->onNotAllowed(); - } - - $data = $this->transformPostData($data); - - $item = $this->createModelInstance(); - - $newItem = $this->createItem($item, $data); - - if (!$newItem) { - return $this->onCreateFailed($item, $data); - } - - $primaryKey = $this->getModelPrimaryKey(); - $responseData = $this->getFindData($newItem->$primaryKey); - - $response = $this->getCreateResponse($responseData, $data); - - $this->afterHandleCreate($newItem, $data, $response); - $this->afterHandleWrite(); - $this->afterHandle(); - - return $response; + return parent::create(); } diff --git a/app/library/App/Model/User.php b/app/library/App/Model/User.php index 9bd18af..81dd212 100755 --- a/app/library/App/Model/User.php +++ b/app/library/App/Model/User.php @@ -1,7 +1,6 @@ add( - 'email', - new EmailValidator( - [ - 'model' => $this, - 'message' => 'Please enter a correct email address', - ] - ) - ); - - return $this->validate($validator); - } } -- libgit2 0.21.4