src/Flexy/Apps/CueClubBundle/Entity/CueClubProduct.php line 13
<?php
namespace App\Flexy\Apps\CueClubBundle\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Flexy\ShopBundle\Entity\Product\Product;
use App\Repository\Flexy\Apps\CueClubBundle\Entity\CueClubProductRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CueClubProductRepository::class)]
#[ApiResource]
class CueClubProduct
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
#[ORM\JoinColumn(nullable: false)]
private ?Product $product = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
public function __toString()
{
return $this->product ? $this->product->getName() : $this->description ;
}
public function getId(): ?int
{
return $this->id;
}
public function getProduct(): ?Product
{
return $this->product;
}
public function setProduct(Product $product): static
{
$this->product = $product;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
}