get('db2'); } /** * @inheritdoc */ public function rules() { return [ [['CancelFlag', 'HotelId', 'ChannelId'], 'integer'], [['ChannelHotelId', 'HotelId', 'ChannelId'], 'required'], [['ChannelHotelId'], 'string', 'max' => 20], [['HotelId', 'ChannelId'], 'unique', 'targetAttribute' => ['HotelId', 'ChannelId'], 'message' => 'The combination of 本地酒店ID and 渠道ID 1:携程 has already been taken.'], [['ChannelHotelId', 'ChannelId'], 'unique', 'targetAttribute' => ['ChannelHotelId', 'ChannelId'], 'message' => 'The combination of 渠道酒店ID and 渠道ID 1:携程 has already been taken.'], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'CancelFlag' => 'Cancel Flag', 'ChannelHotelId' => '渠道酒店ID', 'HotelId' => '本地酒店ID', 'ChannelId' => '渠道ID 1:携程', ]; } /** * 更新数据 */ public function beforeSave($insert) { if($this -> isNewRecord) { $this -> CancelFlag = 0; } return parent::beforeSave($insert); } }