src/MobileAppApi/Entity/MobileAppUserPreferences.php line 18

Open in your IDE?
  1. <?php
  2. namespace MobileAppApi\Entity;
  3. use App\Entity\User;
  4. use App\Utility\DateTimeUtility;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Exception;
  8. /**
  9. * @ORM\Entity
  10. *
  11. * @ORM\Table(
  12. * name="mobile_app_user_preferences"
  13. * )
  14. */
  15. class MobileAppUserPreferences
  16. {
  17. /** @throws Exception */
  18. public function __construct(User $user)
  19. {
  20. $this->user = $user;
  21. $this->createdAt = DateTimeUtility::createDateTimeUtc();
  22. $this->showForwardingToWebDialog = true;
  23. }
  24. /**
  25. * @ORM\OneToOne(targetEntity="App\Entity\User", cascade={"persist"})
  26. *
  27. * @ORM\JoinColumn(name="users_id", referencedColumnName="id", onDelete="CASCADE")
  28. *
  29. * @ORM\Id
  30. */
  31. private User $user;
  32. public function getUser(): User
  33. {
  34. return $this->user;
  35. }
  36. /**
  37. * @ORM\Column(name="created_at", type="datetime", nullable=false)
  38. */
  39. private DateTime $createdAt;
  40. /**
  41. * @ORM\Column(name="show_forwarding_to_web_dialog", type="boolean", nullable=false)
  42. */
  43. private bool $showForwardingToWebDialog;
  44. public function setShowForwardingToWebDialog(bool $showForwardingToWebDialog): void
  45. {
  46. $this->showForwardingToWebDialog = $showForwardingToWebDialog;
  47. }
  48. public function showForwardingToWebDialog(): bool
  49. {
  50. return $this->showForwardingToWebDialog;
  51. }
  52. }