src/Entity/Product.php line 25

  1. <?php
  2. /*
  3.  *  @author Guerby Duval <info@tranzaksyon.com>
  4.  *  @link https://tranzaksyon.com
  5.  *  @copyright You are not allowed to remove this author "Guerby Duval <info@tranzaksyon.com>", the link "https://tranzaksyon.com" neither this copyright.
  6.  */
  7. namespace App\Entity;
  8. use App\Interfaces\OwnerCompanyInterface;
  9. use App\Repository\ProductRepository;
  10. use Doctrine\DBAL\Types\Types;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Symfony\Component\HttpFoundation\File\File;
  13. use Symfony\Component\Serializer\Annotation\Groups;
  14. use Symfony\Component\Validator\Constraints\GreaterThanOrEqual;
  15. use Symfony\Component\Validator\Constraints\Length;
  16. use Symfony\Component\Validator\Constraints\NotBlank;
  17. use Symfony\Component\Validator\Constraints\NotNull;
  18. use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
  19. use Vich\UploaderBundle\Mapping\Annotation\UploadableField;
  20. #[ORM\Entity(repositoryClassProductRepository::class)]
  21. #[Uploadable]
  22. class Product implements OwnerCompanyInterface
  23. {
  24.     const NORMALIZATION_CONTEXT = [
  25.         'groups' =>
  26.             ['product_out''tax_out''product_option_out''stock_out''product_extra_option_group_out''product_extra_option_out']];
  27.     #[ORM\Id]
  28.     #[ORM\GeneratedValue]
  29.     #[ORM\Column]
  30.     #[Groups(['product_out''product_simple_out'])]
  31.     private ?int $id null;
  32.     #[ORM\Column(length255)]
  33.     #[NotBlank]
  34.     #[Groups(['product_out''product_in''product_simple_out'])]
  35.     private ?string $name null;
  36.     #[ORM\Column(length25)]
  37.     #[NotBlank]
  38.     #[Length(max25)]
  39.     #[Groups(['product_out''product_in''product_simple_out'])]
  40.     private ?string $sku null;
  41.     #[ORM\Column(typeTypes::DECIMALprecision20scale6)]
  42.     #[NotNull(groups: ['with-price'])]
  43.     #[GreaterThanOrEqual(0.01groups: ['with-price'])]
  44.     #[Groups(['product_out''product_in'])]
  45.     private ?string $price null;
  46.     #[ORM\ManyToOne(cascade: ['persist'])]
  47.     #[Groups(['product_out''product_in'])]
  48.     private ?Tax $tax null;
  49.     #[ORM\ManyToOne(inversedBy'products')]
  50.     #[ORM\JoinColumn(nullablefalse)]
  51.     private ?SriInfo $sriInfo null;
  52.     #[ORM\Column(nullabletrue)]
  53.     private ?bool $noList null;
  54.     #[ORM\Column(typeTypes::DECIMALprecision20scale3nullabletrue)]
  55.     private ?string $precioCosto null;
  56.     #[ORM\Column(length255nullabletrue)]
  57.     private ?string $externalId null;
  58.     #[ORM\Column(length20nullabletrue)]
  59.     #[Groups(['product_out''product_in'])]
  60.     private ?string $barCode null;
  61.     #[ORM\ManyToOne]
  62.     #[ORM\JoinColumn()]
  63.     private ?Invoice $invoice null;
  64.     #[ORM\Column(nullabletrue)]
  65.     private ?int $freeAt null;
  66.     #[ORM\Column(nullabletrueoptions: ['default' => true])]
  67.     private ?bool $active null;
  68.     #[ORM\Column(length20nullabletrue)]
  69.     private ?string $productType null;
  70.     #[ORM\Column(nullabletrue)]
  71.     private ?bool $bought null;
  72.     #[ORM\Column(nullabletrue)]
  73.     #[Groups(['product_out'])]
  74.     private ?int $maxOption null;
  75.     #[UploadableField('uploadable''imagePath''imageSize''imageMime''imageOriginalName')]
  76.     private ?File $imageFile null;
  77.     #[ORM\Column(length255nullabletrue)]
  78.     #[Groups(['product_out'])]
  79.     private ?string $imagePath null;
  80.     #[ORM\Column(length20nullabletrue)]
  81.     private ?string $imageMime null;
  82.     #[ORM\Column(nullabletrue)]
  83.     private ?float $imageSize null;
  84.     #[ORM\Column(length255nullabletrue)]
  85.     private ?string $imageOriginalName null;
  86.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  87.     private ?string $description null;
  88.     #[ORM\Column(length255nullabletrue)]
  89.     private ?string $brand null;
  90.     #[ORM\Column(nullabletrue)]
  91.     private ?float $width null;
  92.     #[ORM\Column(nullabletrue)]
  93.     private ?float $height null;
  94.     #[ORM\Column(nullabletrue)]
  95.     private ?float $depth null;
  96.     #[ORM\Column(nullabletrue)]
  97.     private ?float $weight null;
  98.     public function __construct()
  99.     {
  100.     }
  101.     public function getId(): ?int
  102.     {
  103.         return $this->id;
  104.     }
  105.     public function getName(): ?string
  106.     {
  107.         return $this->name;
  108.     }
  109.     public function setName(string $name): self
  110.     {
  111.         $this->name $name;
  112.         return $this;
  113.     }
  114.     public function getSku(): ?string
  115.     {
  116.         return $this->sku;
  117.     }
  118.     public function setSku(string $sku): self
  119.     {
  120.         $this->sku $sku;
  121.         return $this;
  122.     }
  123.     public function getPrice(): ?string
  124.     {
  125.         return $this->price;
  126.     }
  127.     public function setPrice(string $price): self
  128.     {
  129.         $this->price $price;
  130.         return $this;
  131.     }
  132.     public function getTax(): ?Tax
  133.     {
  134.         return $this->tax;
  135.     }
  136.     public function setTax(?Tax $tax): self
  137.     {
  138.         $this->tax $tax;
  139.         return $this;
  140.     }
  141.     public function getSriInfo(): ?SriInfo
  142.     {
  143.         return $this->sriInfo;
  144.     }
  145.     public function setSriInfo(?SriInfo $sriInfo): self
  146.     {
  147.         $this->sriInfo $sriInfo;
  148.         return $this;
  149.     }
  150.     public function getPrecioCosto(): ?string
  151.     {
  152.         return $this->precioCosto;
  153.     }
  154.     public function setPrecioCosto(?string $precioCosto): self
  155.     {
  156.         $this->precioCosto $precioCosto;
  157.         return $this;
  158.     }
  159.     public function getExternalId(): ?string
  160.     {
  161.         return $this->externalId;
  162.     }
  163.     public function setExternalId(?string $externalId): self
  164.     {
  165.         $this->externalId $externalId;
  166.         return $this;
  167.     }
  168.     public function getBarCode(): ?string
  169.     {
  170.         return $this->barCode;
  171.     }
  172.     public function setBarCode(?string $barCode): self
  173.     {
  174.         $this->barCode $barCode;
  175.         return $this;
  176.     }
  177.     public function isNoList(): ?bool
  178.     {
  179.         return $this->noList;
  180.     }
  181.     public function setNoList(?bool $noList): self
  182.     {
  183.         $this->noList $noList;
  184.         return $this;
  185.     }
  186.     public function getInvoice(): ?Invoice
  187.     {
  188.         return $this->invoice;
  189.     }
  190.     public function setInvoice(?Invoice $invoice): self
  191.     {
  192.         $this->invoice $invoice;
  193.         return $this;
  194.     }
  195.     public function isActive(): ?bool
  196.     {
  197.         return $this->active;
  198.     }
  199.     public function setActive(?bool $active): static
  200.     {
  201.         $this->active $active;
  202.         return $this;
  203.     }
  204.     public function getProductType(): ?string
  205.     {
  206.         return $this->productType;
  207.     }
  208.     public function setProductType(?string $productType): static
  209.     {
  210.         $this->productType $productType;
  211.         return $this;
  212.     }
  213.     public function isBought(): ?bool
  214.     {
  215.         return $this->bought;
  216.     }
  217.     public function setBought(?bool $bought): static
  218.     {
  219.         $this->bought $bought;
  220.         return $this;
  221.     }
  222.     public function getMaxOption(): ?int
  223.     {
  224.         return $this->maxOption;
  225.     }
  226.     public function setMaxOption(?int $maxOption): static
  227.     {
  228.         $this->maxOption $maxOption;
  229.         return $this;
  230.     }
  231.     public function getImagePath(): ?string
  232.     {
  233.         return $this->imagePath;
  234.     }
  235.     public function setImagePath(?string $imagePath): static
  236.     {
  237.         $this->imagePath $imagePath;
  238.         return $this;
  239.     }
  240.     public function getImageMime(): ?string
  241.     {
  242.         return $this->imageMime;
  243.     }
  244.     public function setImageMime(?string $imageMime): static
  245.     {
  246.         $this->imageMime $imageMime;
  247.         return $this;
  248.     }
  249.     public function getImageSize(): ?float
  250.     {
  251.         return $this->imageSize;
  252.     }
  253.     public function setImageSize(?float $imageSize): static
  254.     {
  255.         $this->imageSize $imageSize;
  256.         return $this;
  257.     }
  258.     public function getImageOriginalName(): ?string
  259.     {
  260.         return $this->imageOriginalName;
  261.     }
  262.     public function setImageOriginalName(?string $imageOriginalName): static
  263.     {
  264.         $this->imageOriginalName $imageOriginalName;
  265.         return $this;
  266.     }
  267.     /**
  268.      * @return File|null
  269.      */
  270.     public function getImageFile(): ?File
  271.     {
  272.         return $this->imageFile;
  273.     }
  274.     /**
  275.      * @param File|null $imageFile
  276.      */
  277.     public function setImageFile(?File $imageFile): void
  278.     {
  279.         $this->imageFile $imageFile;
  280.     }
  281.     public function getDescription(): ?string
  282.     {
  283.         return $this->description;
  284.     }
  285.     public function setDescription(?string $description): static
  286.     {
  287.         $this->description $description;
  288.         return $this;
  289.     }
  290.     public function getBrand(): ?string
  291.     {
  292.         return $this->brand;
  293.     }
  294.     public function setBrand(?string $brand): static
  295.     {
  296.         $this->brand $brand;
  297.         return $this;
  298.     }
  299.     public function getFreeAt(): ?int
  300.     {
  301.         return $this->freeAt;
  302.     }
  303.     public function setFreeAt(?int $freeAt): static
  304.     {
  305.         $this->freeAt $freeAt;
  306.         return $this;
  307.     }
  308.     public function getWidth(): ?float
  309.     {
  310.         return $this->width;
  311.     }
  312.     public function setWidth(float $width): static
  313.     {
  314.         $this->width $width;
  315.         return $this;
  316.     }
  317.     public function getHeight(): ?float
  318.     {
  319.         return $this->height;
  320.     }
  321.     public function setHeight(float $height): static
  322.     {
  323.         $this->height $height;
  324.         return $this;
  325.     }
  326.     public function getDepth(): ?float
  327.     {
  328.         return $this->depth;
  329.     }
  330.     public function setDepth(float $depth): static
  331.     {
  332.         $this->depth $depth;
  333.         return $this;
  334.     }
  335.     public function getWeight(): ?float
  336.     {
  337.         return $this->weight;
  338.     }
  339.     public function setWeight(float $weight): static
  340.     {
  341.         $this->weight $weight;
  342.         return $this;
  343.     }
  344. }