|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
-
-
-
- namespace domain\Ticket\TicketUser;
-
- use common\components\ActiveRecordCommon;
- use domain\Ticket\Ticket\Ticket;
- use domain\User\User\User;
-
- class TicketUser extends ActiveRecordCommon
- {
-
-
- public static function tableName()
- {
- return 'ticket_user';
- }
-
-
-
- public function rules()
- {
- return [
- [['id_ticket', 'id_user'], 'required'],
- [['id_ticket', 'id_user'], 'integer'],
- [['read_at'], 'safe'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_ticket' => 'Ticket',
- 'id_user' => 'Utilisateur',
- 'read_at' => 'Date de lecture',
- ];
- }
-
-
-
-
- public function getUser()
- {
- return $this->hasOne(User::class, ['id' => 'id_user']);
- }
-
- public function getTicket()
- {
- return $this->hasOne(Ticket::class, ['id' => 'id_ticket']);
- }
-
- public function populateUser(User $user): void
- {
- $this->populateFieldObject('id_user', 'user', $user);
- }
-
- public function populateTicket(Ticket $ticket): void
- {
- $this->populateFieldObject('id_ticket', 'ticket', $ticket);
- }
- }
|