src/Entity/Notification.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Repository\NotificationRepository;
  5. use Symfony\Component\PropertyAccess\PropertyAccess;
  6. use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;
  7. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClassNotificationRepository::class)]
  10. class Notification implements TranslatableInterface
  11. {
  12.     use TranslatableTrait;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column(type'integer')]
  16.     private $id;
  17.     #[Assert\Valid]
  18.     protected $translations;
  19.     #[ORM\Column(type'text'nullabletrue)]
  20.     private $link;
  21.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'notifications')]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private $user;
  24.     #[ORM\Column(type'boolean'options: ['default' => 0])]
  25.     private $isOpen;
  26.     #[ORM\Column(type'integer')]
  27.     private $type;
  28.     #[ORM\Column(type'smallint')]
  29.     private $status;
  30.     #[ORM\Column(type'datetime_immutable')]
  31.     private $createdAt;
  32.     #[ORM\Column(type'datetime_immutable')]
  33.     private $updatedAt;
  34.     public function __construct()
  35.     {
  36.         $this->isOpen false;
  37.     }
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getType(): ?int
  43.     {
  44.         return $this->type;
  45.     }
  46.     public function setType(int $type): self
  47.     {
  48.         $this->type $type;
  49.         return $this;
  50.     }
  51.     public function getLink(): ?string
  52.     {
  53.         return $this->link;
  54.     }
  55.     public function setLink(?string $link): self
  56.     {
  57.         $this->link $link;
  58.         return $this;
  59.     }
  60.     public function getUser(): ?User
  61.     {
  62.         return $this->user;
  63.     }
  64.     public function setUser(?User $user): self
  65.     {
  66.         $this->user $user;
  67.         return $this;
  68.     }
  69.     public function getIsOpen(): ?bool
  70.     {
  71.         return $this->isOpen;
  72.     }
  73.     public function setIsOpen(bool $isOpen): self
  74.     {
  75.         $this->isOpen $isOpen;
  76.         return $this;
  77.     }
  78.     public function __call($method$arguments)
  79.     {
  80.         return PropertyAccess::createPropertyAccessor()->getValue($this->translate(), $method);
  81.     }
  82.     public function __get($name)
  83.     {
  84.         $method ucfirst($name);
  85.         return $this->proxyCurrentLocaleTranslation($method, []);
  86.     }
  87.     public function __toString()
  88.     {
  89.         return 'test';
  90.     }
  91.     public function getStatus(): ?int
  92.     {
  93.         return $this->status;
  94.     }
  95.     public function setStatus(int $status): self
  96.     {
  97.         $this->status $status;
  98.         return $this;
  99.     }
  100.     public function getCreatedAt(): ?\DateTimeImmutable
  101.     {
  102.         return $this->createdAt;
  103.     }
  104.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  105.     {
  106.         $this->createdAt $createdAt;
  107.         return $this;
  108.     }
  109.     public function getUpdatedAt(): ?\DateTimeImmutable
  110.     {
  111.         return $this->updatedAt;
  112.     }
  113.     public function setUpdatedAt(\DateTimeImmutable $updatedAt): self
  114.     {
  115.         $this->updatedAt $updatedAt;
  116.         return $this;
  117.     }
  118. }