src/Entity/ProductElement.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductElementRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProductElementRepository::class)]
  8. #[ORM\InheritanceType('JOINED')]
  9. #[ORM\DiscriminatorColumn(name"dtype"type"string")]
  10. #[ORM\DiscriminatorMap(
  11.     [
  12.         'hotelRoomType' => HotelRoomType::class,
  13.         'partyZone' => PartyZone::class
  14.     ]
  15. )]
  16. class ProductElement
  17. {
  18.     #[ORM\Id]
  19.     #[ORM\GeneratedValue]
  20.     #[ORM\Column]
  21.     private ?int $id null;
  22.     #[ORM\ManyToOne(inversedBy'productElements')]
  23.     #[ORM\JoinColumn(nullablefalse)]
  24.     private ?Product $product null;
  25.     public function __construct()
  26.     {
  27.     }
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     public function getProduct(): ?Product
  33.     {
  34.         return $this->product;
  35.     }
  36.     public function setProduct(?Product $product): self
  37.     {
  38.         $this->product $product;
  39.         return $this;
  40.     }
  41.     public function getChildToString(): string
  42.     {
  43.         // Check if the child class has overridden the __toString method
  44.         if (method_exists($this'__toString')) {
  45.             return $this->__toString();
  46.         } else {
  47.             return 'Default Child __toString: ' $this->getId();
  48.         }
  49.     }
  50. }