示例#1
0
文件: Sale.php 项目: dench/resistor
 public function getStages()
 {
     return $this->hasMany(Stage::className(), ['id' => 'stage_id'])->viaTable('sale_stage', ['sale_id' => 'id']);
 }
示例#2
0
 /**
  * @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']]];
 }