<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\PwAccidentPlanedRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
#[ORM\Entity(repositoryClass: PwAccidentPlanedRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['PwAccident:read']],
denormalizationContext: ['groups' => ['PwAccident:write']],
order: ['dateEvent' => 'ASC'],
)]
#[ApiFilter(SearchFilter::class, properties: ['city.id' => 'exact', 'street.id' => 'exact', 'otg.id' => 'exact' ])]
#[ApiFilter(DateFilter::class, properties: ['datePlanIn'])]
class PwAccidentPlaned
{
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
#[ORM\Column]
#[Groups(['PwAccident:read', 'PwAccident:write'])]
private ?int $id = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $code_otg = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\ManyToOne(inversedBy: 'pwAccidents')]
private ?PwCity $city = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\ManyToOne(inversedBy: 'pwAccidents')]
private ?PwStreet $street = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dateEvent = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $datePlanIn = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column(length: 255, nullable: true)]
private ?string $koment = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $switchSubReason = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\ManyToOne(inversedBy: 'pwAccidents')]
#[ORM\JoinColumn(nullable: false)]
private ?PwOtg $otg = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $buildingNames = null;
#[Groups(['PwAccident:read', 'PwAccident:write'])]
#[ORM\Column]
private ?int $typeOff = null;
public function getId(): ?int
{
return $this->id;
}
public function getCodeOtg(): ?string
{
return $this->code_otg;
}
public function setCodeOtg(?string $code_otg): static
{
$this->code_otg = $code_otg;
return $this;
}
public function getCity(): ?PwCity
{
return $this->city;
}
public function setCity(?PwCity $city): static
{
$this->city = $city;
return $this;
}
public function getStreet(): ?PwStreet
{
return $this->street;
}
public function setStreet(?PwStreet $street): static
{
$this->street = $street;
return $this;
}
public function getDateEvent(): ?\DateTimeInterface
{
return $this->dateEvent;
}
public function setDateEvent(?\DateTimeInterface $dateEvent): static
{
$this->dateEvent = $dateEvent;
return $this;
}
public function getDatePlanIn(): ?\DateTimeInterface
{
return $this->datePlanIn;
}
public function setDatePlanIn(?\DateTimeInterface $datePlanIn): static
{
$this->datePlanIn = $datePlanIn;
return $this;
}
public function getKoment(): ?string
{
return $this->koment;
}
public function setKoment(?string $koment): static
{
$this->koment = $koment;
return $this;
}
public function getSwitchSubReason(): ?int
{
return $this->switchSubReason;
}
public function setSwitchSubReason(?int $switchSubReason): static
{
$this->switchSubReason = $switchSubReason;
return $this;
}
public function getOtg(): ?PwOtg
{
return $this->otg;
}
public function setOtg(?PwOtg $otg): static
{
$this->otg = $otg;
return $this;
}
public function getBuildingNames(): ?string
{
return $this->buildingNames;
}
public function setBuildingNames(?string $buildingNames): static
{
$this->buildingNames = $buildingNames;
return $this;
}
public function getTypeOff(): ?int
{
return $this->typeOff;
}
public function setTypeOff(int $typeOff): static
{
$this->typeOff = $typeOff;
return $this;
}
}