src/Entity/Journal.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
  4. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  5. use ApiPlatform\Metadata\ApiFilter;
  6. use ApiPlatform\Metadata\ApiResource;
  7. use App\Repository\JournalRepository;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. #[ORM\Entity(repositoryClassJournalRepository::class)]
  11. #[ApiResource(order: ['id' => 'DESC'])]
  12. class Journal
  13. {
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue]
  16.     #[ORM\Column]
  17.     private ?int $id null;
  18.     #[ORM\ManyToOne(inversedBy'journals')]
  19.     #[ORM\JoinColumn(nullabletrue)]
  20.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  21.     private ?User $user null;
  22.     #[ORM\Column]
  23.     #[ApiFilter(DateFilter::class, properties: ["createdAt"])]
  24.     private ?\DateTimeImmutable $createdAt null;
  25.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  26.     private ?string $info null;
  27.     #[ORM\Column(length255nullabletrue)]
  28.     private ?string $ip null;
  29.     #[ORM\Column(nullabletrue)]
  30.     private ?int $object_id null;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     #[ApiFilter(SearchFilter::class, strategy'exact')]
  33.     private ?string $entity null;
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getUser(): ?User
  39.     {
  40.         return $this->user;
  41.     }
  42.     public function setUser(?User $user): static
  43.     {
  44.         $this->user $user;
  45.         return $this;
  46.     }
  47.     public function getCreatedAt(): ?\DateTimeImmutable
  48.     {
  49.         return $this->createdAt;
  50.     }
  51.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  52.     {
  53.         $this->createdAt $createdAt;
  54.         return $this;
  55.     }
  56.     public function getInfo(): ?string
  57.     {
  58.         return $this->info;
  59.     }
  60.     public function setInfo(?string $info): static
  61.     {
  62.         $this->info $info;
  63.         return $this;
  64.     }
  65.     public function getIp(): ?string
  66.     {
  67.         return $this->ip;
  68.     }
  69.     public function setIp(?string $ip): static
  70.     {
  71.         $this->ip $ip;
  72.         return $this;
  73.     }
  74.     public function getObjectId(): ?int
  75.     {
  76.         return $this->object_id;
  77.     }
  78.     public function setObjectId(?int $object_id): static
  79.     {
  80.         $this->object_id $object_id;
  81.         return $this;
  82.     }
  83.     public function getEntity(): ?string
  84.     {
  85.         return $this->entity;
  86.     }
  87.     public function setEntity(?string $entity): static
  88.     {
  89.         $this->entity $entity;
  90.         return $this;
  91.     }
  92.     public function getUserName(): string
  93.     {
  94.         return $this->user $this->user->getDisplayName() : '';
  95.     }
  96. }