<?php
namespace App\Entity;
use App\Repository\ProductCategoryRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ProductCategoryRepository::class)]
#[ORM\Table(name: "dtb_product_category")]
class ProductCategory
{
// Product エンティティとの ManyToOne リレーション(複合主キーの一部として設定)
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: Product::class, inversedBy: "productCategories")]
#[ORM\JoinColumn(name: "product_id", referencedColumnName: "id", nullable: false)]
private ?Product $Product = null;
// Category エンティティとの ManyToOne リレーション(複合主キーの一部として設定)
#[ORM\Id]
#[ORM\ManyToOne(targetEntity: Category::class, inversedBy: "productCategories")]
#[ORM\JoinColumn(name: "category_id", referencedColumnName: "id", nullable: false)]
private ?Category $category = null;
#[ORM\Column(type: "string", length: 255)]
private ?string $discriminator_type = 'productcategory';
public function getProduct(): ?Product
{
return $this->Product;
}
public function setProduct(?Product $product): static
{
$this->Product = $product;
return $this;
}
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): static
{
$this->category = $category;
return $this;
}
public function getDiscriminatorType(): ?string
{
return $this->discriminator_type;
}
public function setDiscriminatorType(string $discriminator_type): static
{
$this->discriminator_type = $discriminator_type;
return $this;
}
}