|
- <?php
-
-
-
- namespace domain\Ticket\TicketMessage;
-
- use common\components\ActiveRecordCommon;
- use domain\Ticket\Ticket\Ticket;
- use domain\User\User\User;
-
- class TicketMessage extends ActiveRecordCommon
- {
-
-
- public static function tableName()
- {
- return 'ticket_message';
- }
-
-
-
- public function rules()
- {
- return [
- [['id_ticket', 'id_user', 'message'], 'required'],
- [['id_ticket', 'id_user'], 'integer'],
- [['message'], 'string'],
- [['created_at'], 'safe'],
- ];
- }
-
-
-
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'id_ticket' => 'Ticket',
- 'id_user' => 'Utilisateur',
- 'message' => 'Message',
- 'created_at' => 'Date de création',
- ];
- }
-
-
-
-
- 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);
- }
- }
|