src/Entity/PwAccident.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\PwAccidentRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use ApiPlatform\Metadata\ApiFilter;
  9. use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
  10. use App\Filter\CustomOrFilter;
  11. #[ORM\Entity(repositoryClassPwAccidentRepository::class)]
  12. #[ApiResource(
  13.     normalizationContext: ['groups' => ['PwAccident:read']],
  14.     denormalizationContext: ['groups' => ['PwAccident:write']],
  15.     cacheHeaders: [
  16.         'max_age' => 60
  17.         'shared_max_age' => 120
  18.         'vary' => ['Authorization''Accept-Language']
  19.     ],
  20. )]
  21. #[ApiFilter(SearchFilter::class, properties: ['city.id' => 'exact''street.id' => 'exact''otg.id' => 'exact''typeOff' => 'exact''switchSubReason' => 'exact' ])]
  22. #[ApiFilter(CustomOrFilter::class)]  
  23. class PwAccident
  24. {
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue(strategy'IDENTITY')]
  27.     #[ORM\Column]
  28.     #[Groups(['PwAccident:read''PwAccident:write'])]
  29.     private ?int $id null;
  30.     #[Groups(['PwAccident:read''PwAccident:write'])]
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $code_otg null;
  33.     #[Groups(['PwAccident:read''PwAccident:write'])]
  34.     #[ORM\ManyToOne(inversedBy'pwAccidents')]
  35.     private ?PwCity $city null;
  36.     #[Groups(['PwAccident:read''PwAccident:write'])]
  37.     #[ORM\ManyToOne(inversedBy'pwAccidents')]
  38.     private ?PwStreet $street null;
  39.     #[Groups(['PwAccident:read''PwAccident:write'])]
  40.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  41.     private ?\DateTimeInterface $dateEvent null;
  42.     #[Groups(['PwAccident:read''PwAccident:write'])]
  43.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  44.     private ?\DateTimeInterface $datePlanIn null;
  45.     #[Groups(['PwAccident:read''PwAccident:write'])]
  46.     #[ORM\Column(length255nullabletrue)]
  47.     private ?string $koment null;
  48.     #[Groups(['PwAccident:read''PwAccident:write'])]
  49.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  50.     private ?int $switchSubReason null;
  51.     #[Groups(['PwAccident:read''PwAccident:write'])]
  52.     #[ORM\ManyToOne(inversedBy'pwAccidents')]
  53.     #[ORM\JoinColumn(nullablefalse)]
  54.     private ?PwOtg $otg null;
  55.     #[Groups(['PwAccident:read''PwAccident:write'])]
  56.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  57.     private ?string $buildingNames null;
  58.     #[Groups(['PwAccident:read''PwAccident:write'])]
  59.     #[ORM\Column]
  60.     private ?int $typeOff null;
  61.     public function getId(): ?int
  62.     {
  63.         return $this->id;
  64.     }
  65.     public function getCodeOtg(): ?string
  66.     {
  67.         return $this->code_otg;
  68.     }
  69.     public function setCodeOtg(?string $code_otg): static
  70.     {
  71.         $this->code_otg $code_otg;
  72.         return $this;
  73.     }
  74.     public function getCity(): ?PwCity
  75.     {
  76.         return $this->city;
  77.     }
  78.     public function setCity(?PwCity $city): static
  79.     {
  80.         $this->city $city;
  81.         return $this;
  82.     }
  83.     public function getStreet(): ?PwStreet
  84.     {
  85.         return $this->street;
  86.     }
  87.     public function setStreet(?PwStreet $street): static
  88.     {
  89.         $this->street $street;
  90.         return $this;
  91.     }
  92.     public function getDateEvent(): ?\DateTimeInterface
  93.     {
  94.         return $this->dateEvent;
  95.     }
  96.     public function setDateEvent(?\DateTimeInterface $dateEvent): static
  97.     {
  98.         $this->dateEvent $dateEvent;
  99.         return $this;
  100.     }
  101.     public function getDatePlanIn(): ?\DateTimeInterface
  102.     {
  103.         return $this->datePlanIn;
  104.     }
  105.     public function setDatePlanIn(?\DateTimeInterface $datePlanIn): static
  106.     {
  107.         $this->datePlanIn $datePlanIn;
  108.         return $this;
  109.     }
  110.     public function getKoment(): ?string
  111.     {
  112.         return $this->koment;
  113.     }
  114.     public function setKoment(?string $koment): static
  115.     {
  116.         $this->koment $koment;
  117.         return $this;
  118.     }
  119.     public function getSwitchSubReason(): ?int
  120.     {
  121.         return $this->switchSubReason;
  122.     }
  123.     public function setSwitchSubReason(?int $switchSubReason): static
  124.     {
  125.         $this->switchSubReason $switchSubReason;
  126.         return $this;
  127.     }
  128.     public function getOtg(): ?PwOtg
  129.     {
  130.         return $this->otg;
  131.     }
  132.     public function setOtg(?PwOtg $otg): static
  133.     {
  134.         $this->otg $otg;
  135.         return $this;
  136.     }
  137.     public function getBuildingNames(): ?string
  138.     {
  139.         return $this->buildingNames;
  140.     }
  141.     public function setBuildingNames(?string $buildingNames): static
  142.     {
  143.         $this->buildingNames $buildingNames;
  144.         return $this;
  145.     }
  146.     public function getTypeOff(): ?int
  147.     {
  148.         return $this->typeOff;
  149.     }
  150.     public function setTypeOff(int $typeOff): static
  151.     {
  152.         $this->typeOff $typeOff;
  153.         return $this;
  154.     }
  155. }