src/Entity/ProductCategory.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductCategoryRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassProductCategoryRepository::class)]
  6. #[ORM\Table(name"dtb_product_category")]
  7. class ProductCategory
  8. {
  9.     // Product エンティティとの ManyToOne リレーション(複合主キーの一部として設定)
  10.     #[ORM\Id]
  11.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy"productCategories")]
  12.     #[ORM\JoinColumn(name"product_id"referencedColumnName"id"nullablefalse)]
  13.     private ?Product $Product null;
  14.     // Category エンティティとの ManyToOne リレーション(複合主キーの一部として設定)
  15.     #[ORM\Id]
  16.     #[ORM\ManyToOne(targetEntityCategory::class, inversedBy"productCategories")]
  17.     #[ORM\JoinColumn(name"category_id"referencedColumnName"id"nullablefalse)]
  18.     private ?Category $category null;
  19.     #[ORM\Column(type"string"length255)]
  20.     private ?string $discriminator_type 'productcategory';
  21.     public function getProduct(): ?Product
  22.     {
  23.         return $this->Product;
  24.     }
  25.     public function setProduct(?Product $product): static
  26.     {
  27.         $this->Product $product;
  28.         return $this;
  29.     }
  30.     public function getCategory(): ?Category
  31.     {
  32.         return $this->category;
  33.     }
  34.     public function setCategory(?Category $category): static
  35.     {
  36.         $this->category $category;
  37.         return $this;
  38.     }
  39.     public function getDiscriminatorType(): ?string
  40.     {
  41.         return $this->discriminator_type;
  42.     }
  43.     public function setDiscriminatorType(string $discriminator_type): static
  44.     {
  45.         $this->discriminator_type $discriminator_type;
  46.         return $this;
  47.     }
  48. }