src/Entity/HotelRoomTypeArrangement.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\HotelRoomTypeArrangementRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. #[ORM\Entity(repositoryClassHotelRoomTypeArrangementRepository::class)]
  7. #[UniqueEntity(fields: ['hotelRoomType''arrangement'])]
  8. class HotelRoomTypeArrangement
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne]
  15.     #[ORM\JoinColumn(nullablefalse)]
  16.     private ?HotelRoomType $hotelRoomType null;
  17.     #[ORM\ManyToOne]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private ?Arrangement $arrangement null;
  20.     public function __construct(HotelRoomType $hotelRoomTypeArrangement $arrangement)
  21.     {
  22.         $this->hotelRoomType $hotelRoomType;
  23.         $this->arrangement $arrangement;
  24.     }
  25.     public function getId(): int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getHotelRoomType(): ?HotelRoomType
  30.     {
  31.         return $this->hotelRoomType;
  32.     }
  33.     public function setHotelRoomType(?HotelRoomType $hotelRoomType): self
  34.     {
  35.         $this->hotelRoomType $hotelRoomType;
  36.         return $this;
  37.     }
  38.     public function getArrangement(): ?Arrangement
  39.     {
  40.         return $this->arrangement;
  41.     }
  42.     public function setArrangement(?Arrangement $arrangement): self
  43.     {
  44.         $this->arrangement $arrangement;
  45.         return $this;
  46.     }
  47.     public function __toString(): string
  48.     {
  49.         return $this->hotelRoomType.' x '.$this->arrangement->getCode();
  50.     }
  51. }