src/Entity/LogsAction.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\GetCollection;
  5. use ApiPlatform\Metadata\Get;
  6. use App\Repository\LogsActionRepository;
  7. use App\Traits\AutoTimestampTrait;
  8. use Doctrine\DBAL\Types\Types;
  9. use Doctrine\ORM\Mapping as ORM;
  10. use Symfony\Component\Serializer\Annotation\Groups;
  11. #[ORM\Entity(repositoryClassLogsActionRepository::class)]
  12. #[ORM\Table(name'logs_actions')]
  13. #[ApiResource(
  14.     operations: [
  15.         new GetCollection(),
  16.         new Get(),
  17.     ],
  18.     normalizationContext: ['groups' => ['action.get']],
  19.     denormalizationContext: ['groups' => ['action.write']]
  20. )]
  21. class LogsAction
  22. {
  23.     use AutoTimestampTrait;
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue]
  26.     #[ORM\Column]
  27.     #[Groups(['action.get'])]
  28.     private ?int $id null;
  29.     #[ORM\ManyToOne(targetEntityUser::class)]
  30.     #[ORM\JoinColumn(nullablefalseonDelete'CASCADE')]
  31.     #[Groups(['action.get''action.write'])]
  32.     private ?User $user null;
  33.     #[ORM\Column(typeTypes::STRINGlength255nullablefalse)]
  34.     #[Groups(['action.get''action.write'])]
  35.     private ?string $action null;
  36.     #[ORM\Column(typeTypes::STRINGlength255nullabletrue)]
  37.     #[Groups(['action.get''action.write'])]
  38.     private ?string $route null;
  39.     #[ORM\Column(typeTypes::STRINGlength10nullabletrue)]
  40.     #[Groups(['action.get''action.write'])]
  41.     private ?string $method null;
  42.     #[ORM\Column(typeTypes::STRINGlength45nullabletrue)]
  43.     #[Groups(['action.get''action.write'])]
  44.     private ?string $ipAddress null;
  45.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  46.     #[Groups(['action.get''action.write'])]
  47.     private ?string $userAgent null;
  48.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  49.     #[Groups(['action.get''action.write'])]
  50.     private ?string $requestData null;
  51.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  52.     #[Groups(['action.get''action.write'])]
  53.     private ?string $responseData null;
  54.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  55.     #[Groups(['action.get''action.write'])]
  56.     private ?string $dataBefore null;
  57.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  58.     #[Groups(['action.get''action.write'])]
  59.     private ?string $dataAfter null;
  60.     #[ORM\Column(typeTypes::INTEGERnullabletrue)]
  61.     #[Groups(['action.get''action.write'])]
  62.     private ?int $statusCode null;
  63.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullablefalse)]
  64.     #[Groups(['session.get''session.write'])]
  65.     protected $createdAt;
  66.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullablefalse)]
  67.     #[Groups(['session.get''session.write'])]
  68.     protected $updatedAt;
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getUser(): ?User
  74.     {
  75.         return $this->user;
  76.     }
  77.     public function setUser(?User $user): static
  78.     {
  79.         $this->user $user;
  80.         return $this;
  81.     }
  82.     public function getAction(): ?string
  83.     {
  84.         return $this->action;
  85.     }
  86.     public function setAction(string $action): static
  87.     {
  88.         $this->action $action;
  89.         return $this;
  90.     }
  91.     public function getRoute(): ?string
  92.     {
  93.         return $this->route;
  94.     }
  95.     public function setRoute(?string $route): static
  96.     {
  97.         $this->route $route;
  98.         return $this;
  99.     }
  100.     public function getMethod(): ?string
  101.     {
  102.         return $this->method;
  103.     }
  104.     public function setMethod(?string $method): static
  105.     {
  106.         $this->method $method;
  107.         return $this;
  108.     }
  109.     public function getIpAddress(): ?string
  110.     {
  111.         return $this->ipAddress;
  112.     }
  113.     public function setIpAddress(?string $ipAddress): static
  114.     {
  115.         $this->ipAddress $ipAddress;
  116.         return $this;
  117.     }
  118.     public function getUserAgent(): ?string
  119.     {
  120.         return $this->userAgent;
  121.     }
  122.     public function setUserAgent(?string $userAgent): static
  123.     {
  124.         $this->userAgent $userAgent;
  125.         return $this;
  126.     }
  127.     public function getRequestData(): ?string
  128.     {
  129.         return $this->requestData;
  130.     }
  131.     public function setRequestData(?string $requestData): static
  132.     {
  133.         $this->requestData $requestData;
  134.         return $this;
  135.     }
  136.     public function getResponseData(): ?string
  137.     {
  138.         return $this->responseData;
  139.     }
  140.     public function setResponseData(?string $responseData): static
  141.     {
  142.         $this->responseData $responseData;
  143.         return $this;
  144.     }
  145.     public function getDataBefore(): ?string
  146.     {
  147.         return $this->dataBefore;
  148.     }
  149.     public function setDataBefore(?string $dataBefore): static
  150.     {
  151.         $this->dataBefore $dataBefore;
  152.         return $this;
  153.     }
  154.     public function getDataAfter(): ?string
  155.     {
  156.         return $this->dataAfter;
  157.     }
  158.     public function setDataAfter(?string $dataAfter): static
  159.     {
  160.         $this->dataAfter $dataAfter;
  161.         return $this;
  162.     }
  163.     public function getStatusCode(): ?int
  164.     {
  165.         return $this->statusCode;
  166.     }
  167.     public function setStatusCode(?int $statusCode): static
  168.     {
  169.         $this->statusCode $statusCode;
  170.         return $this;
  171.     }
  172.     public function getCreatedAt(): ?\DateTimeInterface
  173.     {
  174.         return $this->createdAt;
  175.     }
  176.     public function setCreatedAt(?\DateTimeInterface $createdAt): static
  177.     {
  178.         $this->createdAt $createdAt;
  179.         return $this;
  180.     }
  181.     public function getUpdatedAt(): ?\DateTimeInterface
  182.     {
  183.         return $this->updatedAt;
  184.     }
  185.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
  186.     {
  187.         $this->updatedAt $updatedAt;
  188.         return $this;
  189.     }
  190. }