<?phpdeclare(strict_types=1);namespace Croisiland\CommonBundle\Entity\Flight;use Crea\ToolsBundle\Entity\LifecycleUserIdentifierTrait;use Croisiland\CommonBundle\Entity\Price\Price;use Croisiland\CommonBundle\Repository\Flight\FlightPackageRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=FlightPackageRepository::class) */class FlightPackage{ use LifecycleUserIdentifierTrait; /** * @ORM\Id * * @ORM\GeneratedValue * * @ORM\Column(type="integer") */ private ?int $id; /** * @ORM\ManyToOne(targetEntity=Flight::class) */ private ?Flight $outboundFlight; /** * @ORM\ManyToOne(targetEntity=Flight::class) */ private ?Flight $inboundFlight; /** * @var Collection<int, FlightCost> * * @ORM\OneToMany(targetEntity=FlightCost::class, mappedBy="flightPackage", orphanRemoval=true) */ private $flightCosts; /** * @ORM\ManyToOne(targetEntity=Price::class, inversedBy="flightPackages") * * @ORM\JoinColumn(nullable=false) */ private Price $price; public function __construct() { $this->flightCosts = new ArrayCollection(); } public function getOutboundFlight(): ?Flight { return $this->outboundFlight; } public function setOutboundFlight(?Flight $outboundFlight): self { $this->outboundFlight = $outboundFlight; return $this; } public function getInboundFlight(): ?Flight { return $this->inboundFlight; } public function setInboundFlight(?Flight $inboundFlight): self { $this->inboundFlight = $inboundFlight; return $this; } /** * @return Collection<int, FlightCost> */ public function getFlightCosts(): Collection { return $this->flightCosts; } public function addFlightCost(FlightCost $flightCost): self { if (!$this->flightCosts->contains($flightCost)) { $this->flightCosts[] = $flightCost; $flightCost->setFlightPackage($this); } return $this; } public function removeFlightCost(FlightCost $flightCost): self { if ($this->flightCosts->removeElement($flightCost)) { // set the owning side to null (unless already changed) if ($flightCost->getFlightPackage() === $this) { $flightCost->setFlightPackage(null); } } return $this; } public function getPrice(): ?Price { return $this->price; } public function setPrice(?Price $price): self { $this->price = $price; return $this; }}