src/Entity/Order/OrderItemPhoto.php line 31

  1. <?php
  2. /*
  3.  * This file is part of the Pellipop project.
  4.  *
  5.  * (c) Mobizel
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. declare(strict_types=1);
  11. namespace App\Entity\Order;
  12. use App\Entity\Media\File;
  13. use App\OrderItemPhotoStates;
  14. use App\Repository\Order\OrderItemPhotoRepository;
  15. use App\Validator\Constraints\OrderItemPhotosMaxCount;
  16. use Doctrine\ORM\Mapping as ORM;
  17. use Monofony\Contracts\Core\Model\Media\FileInterface;
  18. use Symfony\Component\Validator\Constraints as Assert;
  19. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  20. /**
  21.  * @Vich\Uploadable
  22.  */
  23. #[ORM\Entity(repositoryClassOrderItemPhotoRepository::class)]
  24. #[ORM\Table(name'app_order_item_photo')]
  25. #[OrderItemPhotosMaxCount()]
  26. class OrderItemPhoto extends File implements FileInterface
  27. {
  28.     /**
  29.      * @Vich\UploadableField(mapping="order_item_photo", fileNameProperty="path")
  30.      */
  31.     #[Assert\Image(maxSize'100M')]
  32.     protected ?\SplFileInfo $file null;
  33.     #[ORM\ManyToOne(inversedBy'photos')]
  34.     #[ORM\JoinColumn(nullablefalse)]
  35.     private ?OrderItem $orderItem null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     #[Groups(['image:read'])]
  38.     private ?string $fujiHash null;
  39.     #[ORM\Column(length20)]
  40.     #[Groups(['image:read'])]
  41.     private ?string $state null;
  42.     #[ORM\Column(length1000nullabletrue)]
  43.     #[Groups(['image:read'])]
  44.     private ?string $tag null;
  45.     public function __construct()
  46.     {
  47.         $this->state OrderItemPhotoStates::STATE_NEW;
  48.         parent::__construct();
  49.     }
  50.     public function getOrderItem(): ?OrderItem
  51.     {
  52.         return $this->orderItem;
  53.     }
  54.     public function setOrderItem(?OrderItem $orderItem): self
  55.     {
  56.         $this->orderItem $orderItem;
  57.         return $this;
  58.     }
  59.     public function getFujiHash(): ?string
  60.     {
  61.         return $this->fujiHash;
  62.     }
  63.     public function setFujiHash(?string $fujiHash): self
  64.     {
  65.         $this->fujiHash $fujiHash;
  66.         return $this;
  67.     }
  68.     public function getState(): ?string
  69.     {
  70.         return $this->state;
  71.     }
  72.     public function setState(string $state): self
  73.     {
  74.         $this->state $state;
  75.         return $this;
  76.     }
  77.     public function getTag(): ?string
  78.     {
  79.         return $this->tag;
  80.     }
  81.     public function setTag(?string $tag): void
  82.     {
  83.         $this->tag $tag;
  84.     }
  85. }