src/Entity/VehicleFuel.php line 23
<?phpnamespace App\Entity;use ApiPlatform\Metadata\ApiResource;use ApiPlatform\Metadata\Get;use App\Repository\VehicleFuelRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation\Groups;#[ApiResource(operations: [new Get(),],normalizationContext: ['groups' => ['fuel:read']],security: "is_granted('PUBLIC_ACCESS')")]#[ORM\Entity(repositoryClass: VehicleFuelRepository::class)]class VehicleFuel{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[Groups(['vehicle:read', 'fuel:read'])]#[ORM\Column(length: 255)]private ?string $name = null;#[ORM\OneToMany(mappedBy: 'fuel', targetEntity: Vehicle::class)]private Collection $vehicles;public function __construct(){$this->vehicles = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->name;}public function setName(string $name): self{$this->name = $name;return $this;}/*** @return Collection<int, Vehicle>*/public function getVehicles(): Collection{return $this->vehicles;}public function addVehicle(Vehicle $vehicle): self{if (!$this->vehicles->contains($vehicle)) {$this->vehicles->add($vehicle);$vehicle->setFuel($this);}return $this;}public function removeVehicle(Vehicle $vehicle): self{if ($this->vehicles->removeElement($vehicle)) {// set the owning side to null (unless already changed)if ($vehicle->getFuel() === $this) {$vehicle->setFuel(null);}}return $this;}}