Beispiel #1
0
 protected function beforeValidate()
 {
     if (empty($this->slug) && !empty($this->title)) {
         $this->slug = $this->generateSlug();
     }
     return parent::beforeValidate();
 }
Beispiel #2
0
 protected function beforeValidate()
 {
     if (empty($this->code)) {
         $this->code = $this->createCode();
     }
     return parent::beforeValidate();
 }
Beispiel #3
0
 protected function beforeValidate()
 {
     if (empty($this->key)) {
         throw new \Exception('Key Can Not Be Empty');
     }
     if (empty($this->content)) {
         throw new \Exception('Content can not be empty');
     }
     return parent::beforeValidate();
 }
Beispiel #4
0
 /**
  */
 protected function beforeValidate()
 {
     if (!$this->get('metadata.creator')) {
         $identity = \Dsc\System::instance()->get('auth')->getIdentity();
         if (!empty($identity->id)) {
             $this->set('metadata.creator', array('id' => $identity->id, 'name' => $identity->fullName()));
         } else {
             $this->set('metadata.creator', array('id' => \Dsc\System::instance()->get('session')->id(), 'name' => 'session'));
         }
     }
     if (!empty($this->items)) {
         $this->items = array_values($this->items);
     }
     return parent::beforeValidate();
 }
Beispiel #5
0
 protected function beforeValidate()
 {
     $this->describableBeforeValidate();
     return parent::beforeValidate();
 }