<?phpdeclare(strict_types=1);namespace Croisiland\CommonBundle\Entity\Ship;use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;use Croisiland\CommonBundle\Annotation\Ship\FuelFormValidator;use Croisiland\CommonBundle\Repository\Ship\FuelRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=FuelRepository::class) * * @FuelFormValidator(groups={"fuel_form_validator"}) */class Fuel{ use LifecycleUserIdentifierTrait; /** * @ORM\Id * * @ORM\GeneratedValue * * @ORM\Column(type="integer") */ private ?int $id; /** * @ORM\Column(type="string", length=255, nullable=false) */ private ?string $name = null; /** * @ORM\Column(type="string", length=255, nullable=true) */ private ?string $fullName = null; /** * @var Collection<int, Ship> * * @ORM\OneToMany(targetEntity=Ship::class, mappedBy="fuel") */ private Collection $ships; public function __construct() { $this->ships = 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; } public function getFullName(): ?string { return $this->fullName; } public function setFullName(?string $fullName): self { $this->fullName = $fullName; return $this; } /** * @return Collection<int, Ship> */ public function getShips(): Collection { return $this->ships; } public function addShip(Ship $ship): self { if (!$this->ships->contains($ship)) { $this->ships[] = $ship; $ship->setFuel($this); } return $this; } public function removeShip(Ship $ship): self { if ($this->ships->removeElement($ship)) { // set the owning side to null (unless already changed) if ($ship->getFuel() === $this) { $ship->setFuel(null); } } return $this; }}