- <?php
-
- namespace domain\User\UserMessage;
-
- use domain\_\AbstractRepositoryQuery;
- use domain\User\User\User;
-
- class UserMessageRepositoryQuery extends AbstractRepositoryQuery
- {
- protected UserMessageDefinition $definition;
-
- public function loadDependencies(): void
- {
- $this->loadDefinition(UserMessageDefinition::class);
- }
-
- public function filterByUser(User $user): self
- {
- $this->andWhere(['user_message.id_user' => $user->id]);
- return $this;
- }
-
- public function filterIsUnread(): self
- {
- $this->andWhere('user_message.read_at IS NULL');
- return $this;
- }
- }
|