64] ]; } /** * @inheritdoc */ public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'value' => function(){ return date('Y-m-d H:i' ); } ] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id_warehouse' => Yii::t('common/warehouse', 'Id Warehouse'), 'name' => Yii::t('common/warehouse', 'Name'), 'status' => Yii::t('common/warehouse', 'Status'), 'created_at' => Yii::t('common/warehouse', 'Created At'), 'updated_at' => Yii::t('common/warehouse', 'Updated At'), ]; } static function statuses() { return [ self::STATUS_ACTIVE => Yii::t('common/warehouse', 'Active'), self::STATUS_DELETED => Yii::t('common/warehouse', 'Inactive'), ]; } public function getStatusHuman(){ $result = null; $s = self::statuses($this->status); if ( array_key_exists($this->status, $s)){ $result = $s[$this->status]; } return $result; } /** * $param int $forceIncludeAccount id warehouse, that should be included in list, even if it is inactive * */ public static function read($forceIncludeObjectWithId = null){ $warehouses = null; if ( $forceIncludeObjectWithId == null){ $warehouses = Warehouse::find()->andWhere(['status' => Warehouse::STATUS_ACTIVE])->all(); }else{ $warehouses = Warehouse::find()->andWhere( ['or', ['status' => Warehouse::STATUS_ACTIVE], ['id_warehouse' => $forceIncludeObjectWithId ] ])->all(); } return $warehouses; } }