public function beforeValidate() { if (!$this->code) { $this->code = yupe\helpers\YText::translit($this->title); } return parent::beforeValidate(); }
/** * beforeValidate * * @return parent::beforeValidate() **/ public function beforeValidate() { // Проверяем наличие установленного хозяина галереи if (isset($this->owner) && empty($this->owner)) { $this->owner = Yii::app()->user->getId(); } return parent::beforeValidate(); }
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(); }
public function beforeValidate() { if (!$this->ip) { $this->ip = Yii::app()->getRequest()->userHostAddress; } return parent::beforeValidate(); }
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(); }
/** * @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(); }
/** * Обновляем дату изменения. Если новая запись * обновляем необходимые поля: * * @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(); }
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(); }
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(); }
public function beforeValidate() { if ($this->markup_type == self::MARKUP_TYPE_RELATION) { $this->getValidatorList()->add(CValidator::createValidator('required', $this, 'view_relation')); } return parent::beforeValidate(); }
/** * Предвалидационные действия: * * @return void */ public function beforeValidate() { $this->status = $this->status ?: self::STATUS_DRAFT; $this->date = date('Y-m-d', strtotime($this->date)); return parent::beforeValidate(); }
public function beforeValidate() { if ($this->isNewRecord) { $this->creation_date = new CDbExpression('NOW()'); $this->user_id = Yii::app()->user->getId(); } return parent::beforeValidate(); }
/** * Предвалидационные действия: * * @return void */ public function beforeValidate() { $this->status = $this->status ?: self::STATUS_DRAFT; return parent::beforeValidate(); }
/** * Предвалидационные действия: * * @return void */ public function beforeValidate() { $this->gender = $this->gender ?: self::GENDER_THING; return parent::beforeValidate(); }
/** * Метод выполняемый перед валидацией: * * @return void */ public function beforeValidate() { /* if($this->getIsNewRecord()) { if(empty($this->role)) { $this->role = User::getAuthenticatedRole(); } } * */ return parent::beforeValidate(); }
/** * Предвалидационные действия: * * @return void */ public function beforeValidate() { if (empty($this->gender)) { $this->gender = self::GENDER_FEMALE; } return parent::beforeValidate(); }
/** * @return bool */ public function beforeValidate() { if (!$this->slug) { $this->slug = yupe\helpers\YText::translit($this->name); } return parent::beforeValidate(); }
/** * @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(); }
/** * Обновляем дату изменения. Если новая запись * обновляем необходимые поля: * * @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(); }
/** * Обновляем дату изменения. Если новая запись * обновляем необходимые поля: * * @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(); }
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(); }