Example #1
0
 protected function beforeValidate()
 {
     if (empty($this->slug) && !empty($this->title)) {
         $this->slug = $this->generateSlug();
     }
     return parent::beforeValidate();
 }
Example #2
0
 protected function beforeValidate()
 {
     if (empty($this->slug)) {
         $this->slug = \Web::instance()->slug($this->namespace);
     }
     $this->enabled = (bool) $this->enabled;
     return parent::beforeValidate();
 }
Example #3
0
 /**
  * 
  */
 protected function beforeValidate()
 {
     if (empty($this->type)) {
         $this->type = $this->__type;
     }
     if (!$this->get('metadata.created')) {
         $this->set('metadata.created', \Dsc\Mongo\Metastamp::getDate('now'));
     }
     $this->set('metadata.last_modified', \Dsc\Mongo\Metastamp::getDate('now'));
     return parent::beforeValidate();
 }
Example #4
0
 protected function beforeValidate()
 {
     $identity = \Dsc\System::instance()->get('auth')->getIdentity();
     if (!$this->get('metadata.creator')) {
         if (!empty($identity->id)) {
             $this->set('metadata.creator', array('id' => $identity->id, 'name' => $identity->fullName()));
         } else {
             $this->set('metadata.creator', array('id' => new \MongoId(), 'name' => 'Unicorn Egg Eater'));
         }
     }
     if (!$this->get('metadata.created')) {
         $this->set('metadata.created', \Dsc\Mongo\Metastamp::getDate('now'));
     }
     $this->set('metadata.last_modified', \Dsc\Mongo\Metastamp::getDate('now'));
     if (!empty($identity->id)) {
         $this->set('metadata.last_modified_by', array('id' => $identity->id, 'name' => $identity->fullName()));
     } else {
         $this->set('metadata.last_modified_by', array('id' => new \MongoId(), 'name' => 'Unicorn Egg Eater'));
     }
     if (empty($this->type)) {
         $this->type = $this->type();
     }
     return parent::beforeValidate();
 }
Example #5
0
 protected function beforeValidate()
 {
     parent::beforeValidate();
 }
Example #6
0
 public function beforeValidate()
 {
     $this->ancestorsBeforeValidate();
     return parent::beforeValidate();
 }