diff options
author | Michael Francis <edude03@gmail.com> | 2011-06-22 15:56:49 -0400 |
---|---|---|
committer | Michael Francis <edude03@gmail.com> | 2011-06-22 15:56:49 -0400 |
commit | 0a2da261e93f3887812c494b64bed5154bdfebab (patch) | |
tree | e742ee507ca2abaeb621c672815acb7b51fc826e /controllers/AnimelistController.php | |
parent | 0fb5924fa5413876c95f97350a981fc565dff306 (diff) | |
download | otakuhub-0a2da261e93f3887812c494b64bed5154bdfebab.tar.xz |
Changed the validation method to skip empty inputs
Diffstat (limited to 'controllers/AnimelistController.php')
-rw-r--r-- | controllers/AnimelistController.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/controllers/AnimelistController.php b/controllers/AnimelistController.php index 874ba7f..add8fb7 100644 --- a/controllers/AnimelistController.php +++ b/controllers/AnimelistController.php @@ -7,6 +7,7 @@ use app\models\User; use app\models\Anime; use app\models\Entry; use \lithium\security\Auth; +use \lithium\util\Validator; class AnimeListController extends \lithium\action\Controller { @@ -81,6 +82,7 @@ class AnimeListController extends \lithium\action\Controller { { //Create an entry with the data $entry = Entry::create($this->request->data); + //Get the current user $user = Auth::check('default'); @@ -93,11 +95,16 @@ class AnimeListController extends \lithium\action\Controller { unset($this->request->data['tags']); } + /* + var_dump($entry->_validates); //If the entry is valid - if ($entry->validates()) { - //Store it, :TODO: make sure this passes at some point, silent failure sucks + if (Validator::check($entry->data(),$entry->_validates, array('skipEmpty' => true))) { + //Store it, :TODO: make sure this passes at some point, silent failures suck $entry->add($username); + */ + if($entry->add($username)) + { //Redirect the user to their anime list return $this->redirect("/animelist/view/$username"); } |