src/Flexy/Apps/CueClubBundle/Entity/CueClubProduct.php line 13

  1. <?php
  2. namespace App\Flexy\Apps\CueClubBundle\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Flexy\ShopBundle\Entity\Product\Product;
  5. use App\Repository\Flexy\Apps\CueClubBundle\Entity\CueClubProductRepository;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassCueClubProductRepository::class)]
  9. #[ApiResource]
  10. class CueClubProduct
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     private ?Product $product null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     public function __toString()
  22.     {
  23.         return $this->product $this->product->getName() : $this->description ;
  24.     }
  25.     public function getId(): ?int
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getProduct(): ?Product
  30.     {
  31.         return $this->product;
  32.     }
  33.     public function setProduct(Product $product): static
  34.     {
  35.         $this->product $product;
  36.         return $this;
  37.     }
  38.     public function getDescription(): ?string
  39.     {
  40.         return $this->description;
  41.     }
  42.     public function setDescription(?string $description): static
  43.     {
  44.         $this->description $description;
  45.         return $this;
  46.     }
  47. }