<?phpnamespace App\Entity;use App\Repository\BookingConstraintSaisonRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;#[ORM\Entity(repositoryClass: BookingConstraintSaisonRepository::class)]class BookingConstraintSaison implements TranslatableInterface{ use TranslatableTrait; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: "integer")] private $id; #[ORM\Column(type: "float")] private $price; #[ORM\ManyToOne(targetEntity: BookingConstraint::class, inversedBy: "saisons")] #[ORM\JoinColumn(nullable: false)] private $bookingConstraint; #[ORM\OneToMany(targetEntity: BookingConstraintSaisonPeriod::class, mappedBy: "bookingConstraintSaison", orphanRemoval: true, cascade: ["persist", "remove"])] private $periods; #[ORM\Column(type: "string", length: 255)] private $icon; public function __construct() { $this->periods = new ArrayCollection(); } public function __toString() { return sprintf($this->translate('fr')->getTitle()); } public function getId(): ?int { return $this->id; } public function getPrice(): ?float { return $this->price; } public function setPrice(float $price): self { $this->price = $price; return $this; } public function getBookingConstraint(): ?BookingConstraint { return $this->bookingConstraint; } public function setBookingConstraint(?BookingConstraint $bookingConstraint): self { $this->bookingConstraint = $bookingConstraint; return $this; } /** * @return Collection|BookingConstraintSaisonPeriod[] */ public function getPeriods(): Collection { return $this->periods; } public function addPeriod(BookingConstraintSaisonPeriod $period): self { if (!$this->periods->contains($period)) { $this->periods[] = $period; $period->setBookingConstraintSaison($this); } return $this; } public function removePeriod(BookingConstraintSaisonPeriod $period): self { if ($this->periods->removeElement($period)) { // set the owning side to null (unless already changed) if ($period->getBookingConstraintSaison() === $this) { $period->setBookingConstraintSaison(null); } } return $this; } public function getIcon(): ?string { return $this->icon; } public function setIcon(string $icon): self { $this->icon = $icon; return $this; }}