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 /models | |
parent | 0fb5924fa5413876c95f97350a981fc565dff306 (diff) | |
download | otakuhub-0a2da261e93f3887812c494b64bed5154bdfebab.tar.xz |
Changed the validation method to skip empty inputs
Diffstat (limited to 'models')
-rw-r--r-- | models/Entry.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/models/Entry.php b/models/Entry.php index a6d9185..e84d438 100644 --- a/models/Entry.php +++ b/models/Entry.php @@ -3,6 +3,8 @@ namespace app\models; use app\models\Users; +use \MongoDate; +use lithium\util\Validator; Class entry extends \lithium\data\Model { public static function __init() { @@ -48,7 +50,14 @@ Class entry extends \lithium\data\Model { $entity->created_on = new MongoDate(); $entity->updated_on = new MongoDate(); $user->animelist[] = $entity; - return $user->save(null, array('validate' => false)); + + if (Validator::check($entity->data(), $this->validates, array('skipEmpty' => 'true'))) { + return $user->save(null, array('validate' => false)); + } + else + { + return false; + } } public function edit($entity, $username) |