Inheritance: extends yii\db\ActiveRecord
Exemple #1
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEFORE_INSERT, [$this, 'beforeInsertChecks']);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, 'beforeUpdateChecks']);
     $this->on(self::EVENT_AFTER_FIND, [$this, 'afterFindInit']);
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority'], 'integer'], [['name', 'code'], 'required'], [['name'], 'string', 'max' => 255], [['code'], 'string', 'max' => 32], [['code'], 'unique'], ['code', 'default', 'value' => function ($model, $attribute) {
         return "sx_auto_" . md5(rand(1, 10) . time());
     }], ['priority', 'default', 'value' => function ($model, $attribute) {
         return 500;
     }]]);
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_AFTER_INSERT, [$this, "afterInstertCallback"]);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, "afterUpdateCallback"]);
     $this->on(self::EVENT_AFTER_INSERT, [$this, "afterSaveEvent"]);
     $this->on(self::EVENT_AFTER_UPDATE, [$this, "afterSaveEvent"]);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'property_id', 'element_id'], 'integer'], [['description'], 'string', 'max' => 255], [['value'], 'string'], ['value_enum', 'filter', 'filter' => function ($value) {
         $value = (int) $value;
         $filter_options = ['options' => ['default' => 0, 'min_range' => -2147483648.0, 'max_range' => 2147483647]];
         return filter_var($value, FILTER_VALIDATE_INT, $filter_options);
     }], ['value_enum', 'integer'], ['value_num', 'filter', 'filter' => function ($value) {
         $value = (double) $value;
         $min_range = -100000000000000.0;
         $max_range = 100000000000000.0;
         if ($value <= $min_range || $value >= $max_range) {
             return 0.0;
         }
         return $value;
     }], ['value_num', 'number']]);
 }
Exemple #5
0
 /**
  * @return bool|int
  * @throws \Exception
  */
 public function delete()
 {
     //Сначала удалить файл
     try {
         $cluster = $this->cluster;
         $cluster->deleteTmpDir($this->cluster_file);
         $cluster->delete($this->cluster_file);
     } catch (\common\components\storage\Exception $e) {
         return false;
     }
     return parent::delete();
 }
Exemple #6
0
 public function scenarios()
 {
     $scenarios = parent::scenarios();
     $scenario = $scenarios[self::SCENARIO_DEFAULT];
     foreach ($scenario as $key => $code) {
         if (in_array($code, ['auth_key', 'password_hash'])) {
             unset($scenario[$key]);
         }
     }
     $scenarios['create'] = $scenario;
     $scenarios['update'] = $scenario;
     return $scenarios;
 }
Exemple #7
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     //$this->on(self::EVENT_BEFORE_INSERT,    [$this, "beforeSaveEvent"]);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, "beforeSaveEvent"]);
     $this->on(self::EVENT_AFTER_INSERT, [$this, "afterSaveCallback"]);
     $this->on(self::EVENT_AFTER_UPDATE, [$this, "afterSaveCallback"]);
     $this->on(self::EVENT_AFTER_DELETE, [$this, "afterSaveCallback"]);
 }
Exemple #8
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['id' => \skeeks\cms\shop\Module::t('app', 'ID'), 'created_by' => \skeeks\cms\shop\Module::t('app', 'Created By'), 'updated_by' => \skeeks\cms\shop\Module::t('app', 'Updated By'), 'created_at' => \skeeks\cms\shop\Module::t('app', 'Created At'), 'updated_at' => \skeeks\cms\shop\Module::t('app', 'Updated At'), 'tax_id' => \skeeks\cms\shop\Module::t('app', 'Income tax'), 'person_type_id' => \skeeks\cms\shop\Module::t('app', 'Payer'), 'value' => \skeeks\cms\shop\Module::t('app', 'Value'), 'currency' => \skeeks\cms\shop\Module::t('app', 'Currency'), 'is_percent' => \skeeks\cms\shop\Module::t('app', 'Is Percent'), 'is_in_price' => \skeeks\cms\shop\Module::t('app', 'Included in the price'), 'priority' => \skeeks\cms\shop\Module::t('app', 'The order of application'), 'active' => \skeeks\cms\shop\Module::t('app', 'Active')]);
 }
Exemple #9
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority', 'multiple_cnt', 'version'], 'integer'], [['name', 'component'], 'required'], [['component_settings'], 'safe'], [['name', 'component', 'hint'], 'string', 'max' => 255], [['code'], 'string', 'max' => 64], [['active', 'property_type', 'list_type', 'multiple', 'with_description', 'searchable', 'filtrable', 'is_required', 'smart_filtrable'], 'string', 'max' => 1], ['code', 'default', 'value' => function ($model, $attribute) {
         return "property" . StringHelper::ucfirst(md5(rand(1, 10) . time()));
     }], ['priority', 'default', 'value' => 500], [['active', 'searchable'], 'default', 'value' => Cms::BOOL_Y], [['is_required', 'smart_filtrable', 'filtrable', 'with_description'], 'default', 'value' => Cms::BOOL_N]]);
 }
Exemple #10
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['code' => \skeeks\cms\shop\Module::t('app', 'Code'), 'name' => \skeeks\cms\shop\Module::t('app', 'Name'), 'description' => \skeeks\cms\shop\Module::t('app', 'Description'), 'priority' => \skeeks\cms\shop\Module::t('app', 'Priority'), 'def' => \skeeks\cms\shop\Module::t('app', 'Default')]);
 }
Exemple #11
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['name'], 'required'], [['name'], 'unique'], [['name', 'description'], 'string']]);
 }
Exemple #12
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at'], 'integer'], [['site_code', 'domain'], 'required'], [['site_code'], 'string', 'max' => 15], [['domain'], 'string', 'max' => 255], [['domain', 'site_code'], 'unique', 'targetAttribute' => ['domain', 'site_code'], 'message' => \Yii::t('app', 'The combination of Site Code and Domain has already been taken.')]]);
 }
Exemple #13
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['id' => \Yii::t('skeeks/shop/app', 'ID'), 'created_by' => \Yii::t('skeeks/shop/app', 'Created By'), 'updated_by' => \Yii::t('skeeks/shop/app', 'Updated By'), 'created_at' => \Yii::t('skeeks/shop/app', 'Created At'), 'updated_at' => \Yii::t('skeeks/shop/app', 'Updated At'), 'name' => \Yii::t('skeeks/shop/app', 'Name'), 'value' => \Yii::t('skeeks/shop/app', 'Value')]);
 }
Exemple #14
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['id' => \Yii::t('skeeks/shop/app', 'ID'), 'created_by' => \Yii::t('skeeks/shop/app', 'Created By'), 'updated_by' => \Yii::t('skeeks/shop/app', 'Updated By'), 'created_at' => \Yii::t('skeeks/shop/app', 'Created At'), 'updated_at' => \Yii::t('skeeks/shop/app', 'Updated At'), 'name' => \Yii::t('skeeks/shop/app', 'Name'), 'priority' => \Yii::t('skeeks/shop/app', 'Priority'), 'active' => \Yii::t('skeeks/shop/app', 'Active'), 'rate' => \Yii::t('skeeks/shop/app', 'Bet')]);
 }
 /**
  * @return array
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['id' => Yii::t('skeeks/cms', 'ID'), 'value' => Yii::t('skeeks/cms', 'Value'), 'component' => Yii::t('skeeks/cms', 'Component'), 'site_code' => Yii::t('skeeks/cms', 'Site Code'), 'user_id' => Yii::t('skeeks/cms', 'User ID'), 'lang_code' => Yii::t('skeeks/cms', 'Lang Code'), 'namespace' => Yii::t('skeeks/cms', 'Namespace')]);
 }
Exemple #16
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     //$this->on(self::EVENT_BEFORE_INSERT,    [$this, "beforeSaveEvent"]);
     $this->on(self::EVENT_BEFORE_UPDATE, [$this, "beforeSaveEvent"]);
 }
Exemple #17
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['priority'], 'integer'], [['code', 'name'], 'required'], [['description'], 'string'], [['code'], 'string', 'max' => 2], [['name'], 'string', 'max' => 255], [['color'], 'string', 'max' => 32], [['code'], 'unique'], [['code'], 'validateCode']]);
 }
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['name' => \Yii::t('skeeks/shop/app', 'Name'), 'priority' => \Yii::t('skeeks/shop/app', 'Priority'), 'active' => \Yii::t('skeeks/shop/app', 'Active'), 'siteCodes' => \Yii::t('skeeks/shop/app', 'Sites')]);
 }
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ArrayHelper::merge(parent::attributeLabels(), ['id' => \Yii::t('skeeks/form2/app', 'ID'), 'created_by' => \Yii::t('skeeks/form2/app', 'Created By'), 'updated_by' => \Yii::t('skeeks/form2/app', 'Updated By'), 'created_at' => \Yii::t('skeeks/form2/app', 'Created At'), 'updated_at' => \Yii::t('skeeks/form2/app', 'Updated At'), 'name' => \Yii::t('skeeks/form2/app', 'Name'), 'description' => \Yii::t('skeeks/form2/app', 'Description'), 'code' => \Yii::t('skeeks/form2/app', 'Code'), 'emails' => \Yii::t('skeeks/form2/app', 'Email addresses'), 'phones' => \Yii::t('skeeks/form2/app', 'Telephones'), 'user_ids' => \Yii::t('skeeks/form2/app', 'User Ids')]);
 }
Exemple #20
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [HasStorageFile::className() => ['class' => HasStorageFile::className(), 'fields' => ['image_id']]]);
 }
Exemple #21
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority'], 'integer'], [['code', 'name'], 'required'], [['active', 'def'], 'string', 'max' => 1], [['code'], 'string', 'max' => 15], [['name', 'server_name', 'description'], 'string', 'max' => 255], [['code'], 'unique'], [['code'], 'validateCode'], [['server_name'], 'validateServerName'], ['priority', 'default', 'value' => 500], ['active', 'default', 'value' => Cms::BOOL_Y], ['def', 'default', 'value' => Cms::BOOL_N], [['image_id'], 'integer']]);
 }
Exemple #22
0
 /**
  * @return array
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [\skeeks\cms\behaviors\RelationalBehavior::className(), HasStorageFile::className() => ['class' => HasStorageFile::className(), 'fields' => ['logo_id']]]);
 }
Exemple #23
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['id' => \Yii::t('skeeks/shop/app', 'ID'), 'created_by' => \Yii::t('skeeks/shop/app', 'Created By'), 'updated_by' => \Yii::t('skeeks/shop/app', 'Updated By'), 'created_at' => \Yii::t('skeeks/shop/app', 'Created At'), 'updated_at' => \Yii::t('skeeks/shop/app', 'Updated At'), 'name' => \Yii::t('skeeks/shop/app', 'Name'), 'description' => \Yii::t('skeeks/shop/app', 'Description'), 'code' => \Yii::t('skeeks/shop/app', 'Code'), 'site_code' => \Yii::t('skeeks/shop/app', 'Site')]);
 }
Exemple #24
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return array_merge(parent::attributeLabels(), ['name' => \skeeks\cms\shop\Module::t('app', 'Name'), 'priority' => \skeeks\cms\shop\Module::t('app', 'Priority'), 'active' => \skeeks\cms\shop\Module::t('app', 'Active'), 'description' => \skeeks\cms\shop\Module::t('app', 'Description'), 'personTypeIds' => \skeeks\cms\shop\Module::t('app', 'Payers'), 'component' => \skeeks\cms\shop\Module::t('app', 'Handler')]);
 }
Exemple #25
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority', 'default_children_tree_type'], 'integer'], [['name', 'code'], 'required'], [['description'], 'string'], [['name', 'viewFile'], 'string', 'max' => 255], [['code'], 'string', 'max' => 50], [['active', 'index_for_search'], 'string', 'max' => 1], [['name_meny', 'name_one'], 'string', 'max' => 100], [['code'], 'unique'], [['code'], 'validateCode'], ['priority', 'default', 'value' => 500], ['active', 'default', 'value' => "Y"], ['name_meny', 'default', 'value' => \Yii::t('skeeks/cms', 'Sections')], ['name_one', 'default', 'value' => \Yii::t('skeeks/cms', 'Section')]]);
 }
Exemple #26
0
 public function behaviors()
 {
     return ArrayHelper::merge(parent::behaviors(), [Serialize::className() => ['class' => Serialize::className(), "fields" => ["data"]]]);
 }
Exemple #27
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'priority', 'default_tree_id', 'root_tree_id'], 'integer'], [['name', 'content_type', 'code'], 'required'], [['description'], 'string'], [['meta_title_template'], 'string'], [['meta_description_template'], 'string'], [['meta_keywords_template'], 'string'], [['name', 'viewFile'], 'string', 'max' => 255], [['code'], 'string', 'max' => 50], [['code'], 'unique'], [['access_check_element'], 'string'], [['code'], 'validateCode'], [['active', 'index_for_search', 'tree_chooser', 'list_mode', 'is_allow_change_tree'], 'string', 'max' => 1], [['content_type'], 'string', 'max' => 32], [['name_meny', 'name_one'], 'string', 'max' => 100], ['priority', 'default', 'value' => 500], ['active', 'default', 'value' => Cms::BOOL_Y], ['is_allow_change_tree', 'default', 'value' => Cms::BOOL_Y], ['access_check_element', 'default', 'value' => Cms::BOOL_N], ['name_meny', 'default', 'value' => Yii::t('app', 'Elements')], ['name_one', 'default', 'value' => Yii::t('app', 'Element')]]);
 }
Exemple #28
0
 /**
  * @inheritdoc
  */
 public function behaviors()
 {
     return array_merge(parent::behaviors(), [TimestampBehavior::className(), HasStorageFile::className() => ['class' => HasStorageFile::className(), 'fields' => ['image_id']], HasRelatedProperties::className() => ['class' => HasRelatedProperties::className(), 'relatedElementPropertyClassName' => CmsUserProperty::className(), 'relatedPropertyClassName' => CmsUserUniversalProperty::className()]]);
 }
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'element_id', 'tree_id'], 'integer'], [['element_id', 'tree_id'], 'required'], [['element_id', 'tree_id'], 'unique', 'targetAttribute' => ['element_id', 'tree_id'], 'message' => \Yii::t('skeeks/cms', 'The combination of Element ID and Tree ID has already been taken.')]]);
 }
Exemple #30
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return array_merge(parent::rules(), [[['created_by', 'updated_by', 'created_at', 'updated_at', 'user_id', 'person_type_id', 'site_id'], 'integer'], [['additional'], 'string'], [['delivery_id'], 'integer'], [['user_id'], 'unique'], [['buyer_id'], 'integer'], [['pay_system_id'], 'integer'], [['pay_system_id', 'buyer_id', 'site_id', 'person_type_id', 'user_id'], 'required', 'on' => self::SCENARIO_CREATE_ORDER]]);
 }