コード例 #1
0
ファイル: Block.php プロジェクト: kuzmina-mariya/gallery
 public function beforeValidate()
 {
     if (!$this->code) {
         $this->code = yupe\helpers\YText::translit($this->title);
     }
     return parent::beforeValidate();
 }
コード例 #2
0
ファイル: Gallery.php プロジェクト: alextravin/yupe
 /**
  * beforeValidate
  *
  * @return parent::beforeValidate()
  **/
 public function beforeValidate()
 {
     // Проверяем наличие установленного хозяина галереи
     if (isset($this->owner) && empty($this->owner)) {
         $this->owner = Yii::app()->user->getId();
     }
     return parent::beforeValidate();
 }
コード例 #3
0
ファイル: Category.php プロジェクト: sherifflight/yupe
 public function beforeValidate()
 {
     if (!$this->alias) {
         $this->alias = yupe\helpers\YText::translit($this->name);
     }
     if (!$this->lang) {
         $this->lang = Yii::app()->language;
     }
     return parent::beforeValidate();
 }
コード例 #4
0
ファイル: UserToken.php プロジェクト: alextravin/yupe
 public function beforeValidate()
 {
     if (!$this->ip) {
         $this->ip = Yii::app()->getRequest()->userHostAddress;
     }
     return parent::beforeValidate();
 }
コード例 #5
0
ファイル: Product.php プロジェクト: RonLab1987/43berega
 public function beforeValidate()
 {
     if (!$this->slug) {
         $this->slug = yupe\helpers\YText::translit($this->name);
     }
     foreach ((array) $this->_eavAttributes as $name => $value) {
         $model = Attribute::model()->getAttributeByName($name);
         if (!$model->isType(Attribute::TYPE_CHECKBOX) && $model->isRequired() && !$value) {
             $this->addError('eav.' . $name, Yii::t("StoreModule.store", "{title} attribute is required", ['title' => $model->title]));
         }
     }
     return parent::beforeValidate();
 }
コード例 #6
0
ファイル: Order.php プロジェクト: syrexby/domovoishop.by
 /**
  * @return bool
  */
 public function beforeValidate()
 {
     if ($this->getScenario() === self::SCENARIO_USER) {
         if (!$this->hasProducts) {
             $this->addError('products', Yii::t('OrderModule.order', 'There are no selected products'));
         }
     }
     return parent::beforeValidate();
 }
コード例 #7
0
ファイル: Feedback.php プロジェクト: kuzmina-mariya/4seasons
 /**
  * Обновляем дату изменения. Если новая запись
  * обновляем необходимые поля:
  *
  * @return void
  */
 public function beforeValidate()
 {
     $this->update_time = new CDbExpression('NOW()');
     if ($this->isNewRecord) {
         $this->create_time = $this->update_time;
         $this->ip = Yii::app()->getRequest()->userHostAddress;
     }
     return parent::beforeValidate();
 }
コード例 #8
0
ファイル: Page.php プロジェクト: alextravin/yupe
 public function beforeValidate()
 {
     if (!$this->slug) {
         $this->slug = yupe\helpers\YText::translit($this->title);
     }
     if (!$this->lang) {
         $this->lang = Yii::app()->getLanguage();
     }
     return parent::beforeValidate();
 }
コード例 #9
0
ファイル: Good.php プロジェクト: alexanderkuz/test-yii2
 public function beforeValidate()
 {
     $this->change_user_id = Yii::app()->user->getId();
     if ($this->isNewRecord) {
         $this->user_id = $this->change_user_id;
     }
     if (!$this->slug) {
         $this->slug = yupe\helpers\YText::translit($this->name);
     }
     return parent::beforeValidate();
 }
コード例 #10
0
 public function beforeValidate()
 {
     if ($this->markup_type == self::MARKUP_TYPE_RELATION) {
         $this->getValidatorList()->add(CValidator::createValidator('required', $this, 'view_relation'));
     }
     return parent::beforeValidate();
 }
コード例 #11
0
 /**
  * Предвалидационные действия:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     $this->status = $this->status ?: self::STATUS_DRAFT;
     $this->date = date('Y-m-d', strtotime($this->date));
     return parent::beforeValidate();
 }
コード例 #12
0
ファイル: Image.php プロジェクト: sherifflight/yupe
 public function beforeValidate()
 {
     if ($this->isNewRecord) {
         $this->creation_date = new CDbExpression('NOW()');
         $this->user_id = Yii::app()->user->getId();
     }
     return parent::beforeValidate();
 }
コード例 #13
0
 /**
  * Предвалидационные действия:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     $this->status = $this->status ?: self::STATUS_DRAFT;
     return parent::beforeValidate();
 }
コード例 #14
0
ファイル: User.php プロジェクト: sherifflight/yupe
 /**
  * Предвалидационные действия:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     $this->gender = $this->gender ?: self::GENDER_THING;
     return parent::beforeValidate();
 }
コード例 #15
0
ファイル: User.php プロジェクト: kuzmina-mariya/happy-end
 /**
  * Метод выполняемый перед валидацией:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     /*
             if($this->getIsNewRecord()) {
        if(empty($this->role)) {
            $this->role = User::getAuthenticatedRole();
        }
             }  
     * 
     */
     return parent::beforeValidate();
 }
コード例 #16
0
ファイル: Profile.php プロジェクト: kuzmina-mariya/happy-end
 /**
  * Предвалидационные действия:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     if (empty($this->gender)) {
         $this->gender = self::GENDER_FEMALE;
     }
     return parent::beforeValidate();
 }
コード例 #17
0
ファイル: Blog.php プロジェクト: syrexby/domovoishop.by
 /**
  * @return bool
  */
 public function beforeValidate()
 {
     if (!$this->slug) {
         $this->slug = yupe\helpers\YText::translit($this->name);
     }
     return parent::beforeValidate();
 }
コード例 #18
0
ファイル: Product.php プロジェクト: yupe/yupe
 /**
  * @return bool
  */
 public function beforeValidate()
 {
     foreach ($this->getTypeAttributes() as $attribute) {
         if ($attribute->isType(Attribute::TYPE_CHECKBOX)) {
             continue;
         }
         if ($attribute->isRequired() && (!isset($this->_typeAttributes[$attribute->id]) || '' === $this->_typeAttributes[$attribute->id])) {
             $this->addError($attribute->title, Yii::t("StoreModule.store", "{title} attribute is required", ['title' => $attribute->title]));
         }
     }
     if (!$this->isInStock()) {
         $this->setEmptyQuantity();
     }
     return parent::beforeValidate();
 }
コード例 #19
0
ファイル: Faq.php プロジェクト: kuzmina-mariya/happy-end
 /**
  * Обновляем дату изменения. Если новая запись
  * обновляем необходимые поля:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     //$this->change_date = new CDbExpression('NOW()');
     $this->change_date = date("Y-m-d H:i:s");
     if ($this->isNewRecord) {
         $this->creation_date = $this->change_date;
         $this->ip = Yii::app()->getRequest()->userHostAddress;
     }
     return parent::beforeValidate();
 }
コード例 #20
0
ファイル: FeedBack.php プロジェクト: sherifflight/yupe
 /**
  * Обновляем дату изменения. Если новая запись
  * обновляем необходимые поля:
  * 
  * @return void
  */
 public function beforeValidate()
 {
     $this->change_date = new CDbExpression('NOW()');
     if ($this->isNewRecord) {
         $this->creation_date = $this->change_date;
         $this->ip = Yii::app()->getRequest()->userHostAddress;
         if (!$this->type) {
             $this->type = self::TYPE_DEFAULT;
         }
     }
     return parent::beforeValidate();
 }
コード例 #21
0
ファイル: Table.php プロジェクト: kuzmina-mariya/happy-end
 public function beforeValidate()
 {
     if ($this->show_destiny_table) {
         $this->getValidatorList()->add(CValidator::createValidator('required', $this, 'source_destiny_table'));
     }
     if ($this->show_event_table) {
         $this->getValidatorList()->add(CValidator::createValidator('required', $this, 'source_event_table'));
     }
     return parent::beforeValidate();
 }