diff options
Diffstat (limited to 'models/Entry.php')
-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) |