src/Entity/ProductElement.php line 19

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.         'vehiculeType' => VehiculeType::class
  15.     ]
  16. )]
  17. class ProductElement
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[ORM\ManyToOne(inversedBy'productElements')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private ?Product $product null;
  26.     public function __construct()
  27.     {
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getProduct(): ?Product
  34.     {
  35.         return $this->product;
  36.     }
  37.     public function setProduct(?Product $product): self
  38.     {
  39.         $this->product $product;
  40.         return $this;
  41.     }
  42.     public function getChildToString(): string
  43.     {
  44.         // Check if the child class has overridden the __toString method
  45.         if (method_exists($this'__toString')) {
  46.             return $this->__toString();
  47.         } else {
  48.             return 'Default Child __toString: ' $this->getId();
  49.         }
  50.     }
  51. }