public function checkSales($attribute, $params) { foreach ($this->{$attribute} as $salesId) { $query = new \yii\db\Query(); $query->select('id')->from(ResUsers::tableName())->where('id = :salesIds')->addParams([':salesIds' => $salesId]); if (!$query->exists()) { $this->addError($attribute, 'Sales Man did you search is not exist for sales man id ' . $salesId); } } }
/** * @return \yii\db\ActiveQuery */ public function getCreateU() { return $this->hasOne(ResUsers::className(), ['id' => 'create_uid']); }
/** * @return \yii\db\ActiveQuery */ public function getSalesMan() { return $this->hasOne(ResUsers::className(), ['id' => 'sales_man_id']); }
/** * @return \yii\db\ActiveQuery */ public function getChecker0() { return $this->hasOne(ResUsers::className(), ['id' => 'checker']); }
/** * @return \yii\db\ActiveQuery */ public function getResUsers() { return $this->hasMany(ResUsers::className(), ['partner_id' => 'id']); }
public function getUser() { return $this->hasOne(ResUsers::className(), ['id' => 'user_id']); }
/** * @return \yii\db\ActiveQuery */ public function getApprover30() { return $this->hasOne(ResUsers::className(), ['id' => 'approver3']); }