public function getStages() { return $this->hasMany(Stage::className(), ['id' => 'stage_id'])->viaTable('sale_stage', ['sale_id' => 'id']); }
/** * @inheritdoc */ public function rules() { return [[['id', 'lang_id', 'name'], 'required'], [['id', 'lang_id'], 'integer'], [['name'], 'string', 'max' => 32], [['id', 'lang_id'], 'unique', 'targetAttribute' => ['id', 'lang_id'], 'message' => 'The combination of ID and Lang ID has already been taken.'], [['id'], 'exist', 'skipOnError' => true, 'targetClass' => Stage::className(), 'targetAttribute' => ['id' => 'id']], [['lang_id'], 'exist', 'skipOnError' => true, 'targetClass' => Lang::className(), 'targetAttribute' => ['lang_id' => 'id']]]; }