From afdcab25d61c8e645b63f62fbbc286887fad840b Mon Sep 17 00:00:00 2001 From: Semenov Date: Wed, 4 Dec 2019 22:02:22 +0300 Subject: [PATCH] dev --- src/models/Measure.php | 112 ----------------------------------------- 1 file changed, 112 deletions(-) delete mode 100644 src/models/Measure.php diff --git a/src/models/Measure.php b/src/models/Measure.php deleted file mode 100644 index 71cc9af..0000000 --- a/src/models/Measure.php +++ /dev/null @@ -1,112 +0,0 @@ -on(self::EVENT_AFTER_FIND, [$this, 'afterFindInit']); - } - - public function afterFindInit(Event $e) - { - $libsInfo = $this->getMeasureClassifierInfo(); - - if (!$this->name) - { - $this->name = ArrayHelper::getValue($libsInfo, 'name'); - } - - if (!$this->symbol) - { - $this->symbol = ArrayHelper::getValue($libsInfo, 'symbol'); - } - - if (!$this->symbol_intl) - { - $this->symbol_intl = ArrayHelper::getValue($libsInfo, 'symbol_intl'); - } - - if (!$this->symbol_letter_intl) - { - $this->symbol_letter_intl = ArrayHelper::getValue($libsInfo, 'symbol_letter_intl'); - } - } - - /** - * @inheritdoc - */ - public function rules() - { - return [ - [['created_by', 'updated_by', 'created_at', 'updated_at'], 'integer'], - [['code'], 'required'], - [['name'], 'string', 'max' => 500], - [['code'], 'string', 'max' => 3], - [['symbol', 'symbol_intl', 'symbol_letter_intl'], 'string', 'max' => 20], - [['code'], 'unique'] - ]; - } - - /** - * @inheritdoc - */ - public function attributeLabels() - { - return [ - 'id' => \Yii::t('skeeks/measure', 'ID'), - 'created_by' => \Yii::t('skeeks/measure', 'Created By'), - 'updated_by' => \Yii::t('skeeks/measure', 'Updated By'), - 'created_at' => \Yii::t('skeeks/measure', 'Created At'), - 'updated_at' => \Yii::t('skeeks/measure', 'Updated At'), - 'code' => \Yii::t('skeeks/measure', 'Code'), - 'name' => \Yii::t('skeeks/measure', 'Unit of measure'), - 'symbol' => \Yii::t('skeeks/measure', 'Conventional symbol'), - 'symbol_intl' => \Yii::t('skeeks/measure', 'Conventional symbol (international)'), - 'symbol_letter_intl' => \Yii::t('skeeks/measure', 'The code letter of symbol (international)'), - ]; - } - - - /** - * @return array - */ - public function getMeasureClassifierInfo() - { - return (array) \Yii::$app->measureClassifier->getMeasureInfoByCode($this->code); - } -} \ No newline at end of file