You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UserMessageRepositoryQuery.php 630B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace domain\User\UserMessage;
  3. use domain\_\AbstractRepositoryQuery;
  4. use domain\User\User\User;
  5. class UserMessageRepositoryQuery extends AbstractRepositoryQuery
  6. {
  7. protected UserMessageDefinition $definition;
  8. public function loadDependencies(): void
  9. {
  10. $this->loadDefinition(UserMessageDefinition::class);
  11. }
  12. public function filterByUser(User $user): self
  13. {
  14. $this->andWhere(['user_message.id_user' => $user->id]);
  15. return $this;
  16. }
  17. public function filterIsUnread(): self
  18. {
  19. $this->andWhere('user_message.read_at IS NULL');
  20. return $this;
  21. }
  22. }