src/Entity/ProductImage.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductImageRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassProductImageRepository::class)]
  7. #[ORM\Table(name"dtb_product_image")]
  8. class ProductImage
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\ManyToOne(targetEntityProduct::class, inversedBy'productImages')]
  15.     #[ORM\JoinColumn(name'product_id'referencedColumnName'id'nullabletrue)]
  16.     private ?Product $Product null;
  17.     #[ORM\ManyToOne(targetEntityMember::class)]
  18.     #[ORM\JoinColumn(name"creator_id"referencedColumnName"id"nullabletrue)]
  19.     private ?Member $Creator null;
  20.     #[ORM\Column(length255)]
  21.     private ?string $file_name null;
  22.     #[ORM\Column(typeTypes::SMALLINT)]
  23.     private ?int $sort_no null;
  24.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  25.     private ?\DateTimeInterface $create_date null;
  26.     #[ORM\Column(length255)]
  27.     private ?string $discriminator_type 'productimage';
  28.     public function getId(): ?int
  29.     {
  30.         return $this->id;
  31.     }
  32.     /**
  33.      * Set the product.
  34.      *
  35.      * @param Product|null $product
  36.      * @return self
  37.      */
  38.     public function setProduct(?Product $product): self
  39.     {
  40.         $this->Product $product;
  41.         return $this;
  42.     }
  43.     /**
  44.      * Get the product.
  45.      *
  46.      * @return Product|null
  47.      */
  48.     public function getProduct(): ?Product
  49.     {
  50.         return $this->Product;
  51.     }
  52.     /**
  53.      * Set the creator.
  54.      *
  55.      * @param Member|null $creator
  56.      * @return self
  57.      */
  58.     public function setCreator(?Member $creator): self
  59.     {
  60.         $this->Creator $creator;
  61.         return $this;
  62.     }
  63.     /**
  64.      * Get the creator.
  65.      *
  66.      * @return Member|null
  67.      */
  68.     public function getCreator(): ?Member
  69.     {
  70.         return $this->Creator;
  71.     }
  72.     public function getFileName(): ?string
  73.     {
  74.         return $this->file_name;
  75.     }
  76.     public function setFileName(string $file_name): static
  77.     {
  78.         $this->file_name $file_name;
  79.         return $this;
  80.     }
  81.     public function getSortNo(): ?int
  82.     {
  83.         return $this->sort_no;
  84.     }
  85.     public function setSortNo(int $sort_no): static
  86.     {
  87.         $this->sort_no $sort_no;
  88.         return $this;
  89.     }
  90.     public function getCreateDate(): ?\DateTimeInterface
  91.     {
  92.         return $this->create_date;
  93.     }
  94.     public function setCreateDate(\DateTimeInterface $create_date): static
  95.     {
  96.         $this->create_date $create_date;
  97.         return $this;
  98.     }
  99.     public function getDiscriminatorType(): ?string
  100.     {
  101.         return $this->discriminator_type;
  102.     }
  103.     public function setDiscriminatorType(string $discriminator_type): static
  104.     {
  105.         $this->discriminator_type $discriminator_type;
  106.         return $this;
  107.     }
  108.     /**
  109.      * 画像ファイルのURLを生成する
  110.      *
  111.      * @return string|null
  112.      */
  113.     public function getFilePath(): ?string
  114.     {
  115.         return '/uploads/eccube_images/' $this->file_name;
  116.     }
  117. }