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(); }