| @@ 15-64 (lines=50) @@ | ||
| 12 | * @property Device $device |
|
| 13 | * @property Screen $screen |
|
| 14 | */ |
|
| 15 | class DeviceHasScreen extends \yii\db\ActiveRecord |
|
| 16 | { |
|
| 17 | /** |
|
| 18 | * {@inheritdoc} |
|
| 19 | */ |
|
| 20 | public static function tableName() |
|
| 21 | { |
|
| 22 | return 'device_has_screen'; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * {@inheritdoc} |
|
| 27 | */ |
|
| 28 | public function rules() |
|
| 29 | { |
|
| 30 | return [ |
|
| 31 | [['device_id', 'screen_id'], 'required'], |
|
| 32 | [['device_id', 'screen_id'], 'integer'], |
|
| 33 | [['device_id'], 'exist', 'skipOnError' => true, 'targetClass' => Device::class, 'targetAttribute' => ['device_id' => 'id']], |
|
| 34 | [['screen_id'], 'exist', 'skipOnError' => true, 'targetClass' => Screen::class, 'targetAttribute' => ['screen_id' => 'id']], |
|
| 35 | ]; |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * {@inheritdoc} |
|
| 40 | */ |
|
| 41 | public function attributeLabels() |
|
| 42 | { |
|
| 43 | return [ |
|
| 44 | 'device_id' => Yii::t('app', 'Device ID'), |
|
| 45 | 'screen_id' => Yii::t('app', 'Screen ID'), |
|
| 46 | ]; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @return \yii\db\ActiveQuery |
|
| 51 | */ |
|
| 52 | public function getDevice() |
|
| 53 | { |
|
| 54 | return $this->hasOne(Device::class, ['id' => 'device_id']); |
|
| 55 | } |
|
| 56 | ||
| 57 | /** |
|
| 58 | * @return \yii\db\ActiveQuery |
|
| 59 | */ |
|
| 60 | public function getScreen() |
|
| 61 | { |
|
| 62 | return $this->hasOne(Screen::class, ['id' => 'screen_id']); |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| @@ 16-65 (lines=50) @@ | ||
| 13 | * @property Screen $screen |
|
| 14 | * @property Flow $flow |
|
| 15 | */ |
|
| 16 | class ScreenHasFlow extends \yii\db\ActiveRecord |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @inheritdoc |
|
| 20 | */ |
|
| 21 | public static function tableName() |
|
| 22 | { |
|
| 23 | return 'screen_has_flow'; |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * @inheritdoc |
|
| 28 | */ |
|
| 29 | public function rules() |
|
| 30 | { |
|
| 31 | return [ |
|
| 32 | [['screen_id', 'flow_id'], 'required'], |
|
| 33 | [['screen_id', 'flow_id'], 'integer'], |
|
| 34 | [['screen_id'], 'exist', 'skipOnError' => true, 'targetClass' => Screen::class, 'targetAttribute' => ['screen_id' => 'id']], |
|
| 35 | [['flow_id'], 'exist', 'skipOnError' => true, 'targetClass' => Flow::class, 'targetAttribute' => ['flow_id' => 'id']], |
|
| 36 | ]; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @inheritdoc |
|
| 41 | */ |
|
| 42 | public function attributeLabels() |
|
| 43 | { |
|
| 44 | return [ |
|
| 45 | 'screen_id' => Yii::t('app', 'Screen ID'), |
|
| 46 | 'flow_id' => Yii::t('app', 'Flow ID'), |
|
| 47 | ]; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return \yii\db\ActiveQuery |
|
| 52 | */ |
|
| 53 | public function getScreen() |
|
| 54 | { |
|
| 55 | return $this->hasOne(Screen::class, ['id' => 'screen_id']); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return \yii\db\ActiveQuery |
|
| 60 | */ |
|
| 61 | public function getFlow() |
|
| 62 | { |
|
| 63 | return $this->hasOne(Flow::class, ['id' => 'flow_id']); |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||