src/Entity/AppCounterReading.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\AppCounterReadingRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use ApiPlatform\Metadata\ApiFilter;
  8. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Serializer\Annotation\MaxDepth;
  11. use ApiPlatform\Core\Annotation\ApiProperty;
  12. #[ORM\Entity(repositoryClassAppCounterReadingRepository::class)]
  13. #[ApiResource(
  14.     normalizationContext: ['groups' => ['counterRead:read']],
  15.     denormalizationContext: ['groups' => ['counterRead:write']],
  16.     order: ['id' => 'DESC'],
  17. )]
  18. #[ApiFilter(SearchFilter::class, properties: [
  19.     'personal.id' => 'exact'
  20. ])]
  21. #[ORM\HasLifecycleCallbacks]
  22. class AppCounterReading
  23. {
  24.     #[ORM\Id]
  25.     #[ORM\GeneratedValue]
  26.     #[ORM\Column]
  27.     #[Groups(['counterRead:read''counterRead:write''personalAcc:read''user:read'])]
  28.     private ?int $id null;
  29.     #[ORM\ManyToOne(inversedBy'appCounterReadings')]
  30.     #[Groups(['counterRead:read''counterRead:write''user:read'])]
  31.     private ?AppPersonalAccount $personal null;
  32.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  33.     #[Groups(['counterRead:read''counterRead:write''personalAcc:read''user:read'])]
  34.     private ?\DateTimeInterface $dateEntered null;
  35.     #[ORM\Column(nullabletrue)]
  36.     #[Groups(['counterRead:read''counterRead:write''personalAcc:read''user:read'])]
  37.     private ?int $value null;
  38.     #[ORM\Column(nullabletrue)]
  39.     #[Groups(['counterRead:read''counterRead:write''personalAcc:read''user:read'])]
  40.     private ?int $value2 null;
  41.     #[ORM\Column(nullabletrue)]
  42.     #[Groups(['counterRead:read''counterRead:write''personalAcc:read''user:read'])]
  43.     private ?int $value3 null;
  44.     #[ORM\Column(length100nullabletrue)]
  45.     #[Groups(['counterRead:read''counterRead:write''personalAcc:read''user:read'])]
  46.     private ?string $status null;
  47.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  48.     private ?\DateTimeInterface $date_send null;
  49.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  50.     private ?string $description null;
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getPersonal(): ?AppPersonalAccount
  56.     {
  57.         return $this->personal;
  58.     }
  59.     public function setPersonal(?AppPersonalAccount $personal): static
  60.     {
  61.         $this->personal $personal;
  62.         return $this;
  63.     }
  64.     public function getDateEntered(): ?\DateTimeInterface
  65.     {
  66.         return $this->dateEntered;
  67.     }
  68.     public function setDateEntered(?\DateTimeInterface $dateEntered): static
  69.     {
  70.         $this->dateEntered $dateEntered;
  71.         return $this;
  72.     }
  73.     public function getValue(): ?int
  74.     {
  75.         return $this->value;
  76.     }
  77.     public function setValue(?int $value): static
  78.     {
  79.         $this->value $value;
  80.         return $this;
  81.     }
  82.     public function getValue2(): ?int
  83.     {
  84.         return $this->value2;
  85.     }
  86.     public function setValue2(?int $value2): static
  87.     {
  88.         $this->value2 $value2;
  89.         return $this;
  90.     }
  91.     public function getValue3(): ?int
  92.     {
  93.         return $this->value3;
  94.     }
  95.     public function setValue3(?int $value3): static
  96.     {
  97.         $this->value3 $value3;
  98.         return $this;
  99.     }
  100.     public function getStatus(): ?string
  101.     {
  102.         return $this->status;
  103.     }
  104.     public function setStatus(?string $status): static
  105.     {
  106.         $this->status $status;
  107.         return $this;
  108.     }
  109.     public function getDateSend(): ?\DateTimeInterface
  110.     {
  111.         return $this->date_send;
  112.     }
  113.     public function setDateSend(?\DateTimeInterface $date_send): static
  114.     {
  115.         $this->date_send $date_send;
  116.         return $this;
  117.     }
  118.     public function getDescription(): ?string
  119.     {
  120.         return $this->description;
  121.     }
  122.     public function setDescription(?string $description): static
  123.     {
  124.         $this->description $description;
  125.         return $this;
  126.     }
  127.     #[ORM\PrePersist]
  128.     public function setCreatedAtValue(): void
  129.     {
  130.         $this->dateEntered = new \DateTime();
  131.     }
  132. }