src/Entity/Product.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. //use Symfony\Bridge\Doctrine\Validator\Constraints as DoctrineAssert;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. /**
  12.  * @ORM\Entity(repositoryClass=ProductRepository::class)
  13.  * @ORM\Table(name="product")
  14.  */
  15. class Product
  16. {
  17.     /**
  18.     * @ORM\Id
  19.     * @ORM\Column(type="integer")
  20.     * @ORM\GeneratedValue(strategy="AUTO")
  21.     */
  22.     protected $id;
  23.     /**
  24.     * @var boolean $public
  25.     *
  26.     * @ORM\Column(type="boolean", nullable=true)
  27.     */
  28.     protected $public;
  29.     /**
  30.     * @var string $name
  31.     *
  32.     * @ORM\Column(type="string", nullable=true)
  33.     */
  34.     protected $name;
  35.     /**
  36.      * @var string $slug
  37.      * @Gedmo\Slug(fields={"name"}, updatable=true, unique=true)
  38.      *
  39.      * @ORM\Column(type="string", nullable=true)
  40.      */
  41.     protected $slug;
  42.     /**
  43.     * @var string $description
  44.     *
  45.     * @ORM\Column(type="text", nullable=true)
  46.     */
  47.     protected $description;
  48.     /**
  49.     * @var string $recommended_uses
  50.     *
  51.     * @ORM\Column(type="text", nullable=true)
  52.     */
  53.     protected $recommended_uses;
  54.     /**
  55.     * @var string $uses
  56.     *
  57.     * @ORM\Column(type="text", nullable=true)
  58.     */
  59.     protected $uses;
  60.     /**
  61.     * @var string $conditions
  62.     *
  63.     * @ORM\Column(type="string", nullable=true)
  64.     */
  65.     protected $conditions;
  66.     /**
  67.     * @var string $tools
  68.     *
  69.     * @ORM\Column(type="string", nullable=true)
  70.     */
  71.     protected $tools;
  72.     /**
  73.     * @var string $dilution
  74.     *
  75.     * @ORM\Column(type="string", nullable=true)
  76.     */
  77.     protected $dilution;
  78.     /**
  79.     * @var string $layers
  80.     *
  81.     * @ORM\Column(type="string", nullable=true)
  82.     */
  83.     protected $layers;
  84.     /**
  85.     * @var string $drying_time
  86.     *
  87.     * @ORM\Column(type="string", nullable=true)
  88.     */
  89.     protected $drying_time;
  90.     /**
  91.     * @var string $touch_drying
  92.     *
  93.     * @ORM\Column(type="string", nullable=true)
  94.     */
  95.     protected $touch_drying;
  96.     /**
  97.     * @var string $repaint_drying
  98.     *
  99.     * @ORM\Column(type="string", nullable=true)
  100.     */
  101.     protected $repaint_drying;
  102.     /**
  103.     * @var string $final_drying
  104.     *
  105.     * @ORM\Column(type="string", nullable=true)
  106.     */
  107.     protected $final_drying;
  108.     /**
  109.     * @var string $image
  110.     *
  111.     * @ORM\ManyToOne(targetEntity="App\Entity\SonataMediaMedia", cascade = {"persist"})
  112.     * @ORM\JoinColumn(name="image_id", referencedColumnName="id", onDelete="SET NULL")
  113.     */
  114.     protected $image;
  115.     /**
  116.     * @var string $image_cover
  117.     *
  118.     * @ORM\ManyToOne(targetEntity="App\Entity\SonataMediaMedia", cascade = {"persist"})
  119.     * @ORM\JoinColumn(name="image_cover_id", referencedColumnName="id", onDelete="SET NULL")
  120.     */
  121.     protected $image_cover;
  122.     /**
  123.     * @var string $video
  124.     *
  125.     * @ORM\ManyToOne(targetEntity="App\Entity\SonataMediaMedia", cascade = {"persist"})
  126.     * @ORM\JoinColumn(name="video_id", referencedColumnName="id", onDelete="SET NULL")
  127.     */
  128.     protected $video;
  129.     /**
  130.     * @var string $video_image
  131.     *
  132.     * @ORM\ManyToOne(targetEntity="App\Entity\SonataMediaMedia", cascade = {"persist"})
  133.     * @ORM\JoinColumn(name="video_image_id", referencedColumnName="id", onDelete="SET NULL")
  134.     */
  135.     protected $video_image;
  136.     /**
  137.     * @var string $data_sheet
  138.     *
  139.     * @ORM\Column(type="string", nullable=true)
  140.     */
  141.     protected $data_sheet;
  142.     /**
  143.     * @var string $safety_sheet
  144.     *
  145.     * @ORM\Column(type="string", nullable=true)
  146.     */
  147.     protected $safety_sheet;
  148.     /**
  149.     * @var string $safety_sheet_cb
  150.     *
  151.     * @ORM\Column(type="string", nullable=true)
  152.     */
  153.     protected $safety_sheet_cb;
  154.     /**
  155.     * @var string $transport_sheet
  156.     *
  157.     * @ORM\Column(type="string", nullable=true)
  158.     */
  159.     protected $transport_sheet;
  160.     /**
  161.     * @var string $packed_colors
  162.     *
  163.     * @ORM\Column(type="string", nullable=true)
  164.     */
  165.     protected $packed_colors;
  166.     /**
  167.     * @var string $link_mp
  168.     *
  169.     * @ORM\Column(type="string", nullable=true)
  170.     */
  171.     protected $link_mp;
  172.     /**
  173.     * Many product have Many categories.
  174.     * @ORM\ManyToMany(targetEntity="App\Entity\ProductCategory")
  175.     * @ORM\JoinTable(name="product_categories",
  176.     *      joinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")},
  177.     *      inverseJoinColumns={@ORM\JoinColumn(name="categories_id", referencedColumnName="id")}
  178.     *      )
  179.     */
  180.     private $categories;
  181.     /**
  182.     * @ORM\OneToMany(targetEntity = "App\Entity\ProductFilter", mappedBy="product", cascade={"persist", "remove"},orphanRemoval=true)
  183.     */
  184.     protected $filters;
  185.     /**
  186.     * @ORM\OneToMany(targetEntity = "App\Entity\ProductColor", mappedBy="product" ,cascade={"persist"})
  187.     */
  188.     protected $colors;
  189.     /**
  190.     * @var \App\Entity\Seo $seo
  191.     *
  192.     * @ORM\ManyToOne(targetEntity="App\Entity\Seo", inversedBy="products")
  193.     * @ORM\JoinColumn(name="seo_id", referencedColumnName="id")
  194.     */
  195.     private $seo;
  196.     /**
  197.      * @var string $create_at
  198.      *
  199.      * @Gedmo\Timestampable(on="create")
  200.      * @ORM\Column(type="datetime", nullable=true)
  201.      */
  202.     protected $create_at;
  203.     /**
  204.      * @var string $update_at
  205.      *
  206.      * @Gedmo\Timestampable(on="update")
  207.      * @ORM\Column(type="datetime", nullable=true)
  208.      */
  209.     protected $update_at;
  210.     public function __construct()
  211.     {
  212.         $this->categories = new ArrayCollection();
  213.         $this->filters = new ArrayCollection();
  214.         $this->colors = new ArrayCollection();
  215.     }
  216.     public function __toString(): string
  217.     {
  218.         return $this->name;
  219.     }
  220.     public function getId(): ?int
  221.     {
  222.         return $this->id;
  223.     }
  224.     public function isPublic(): ?bool
  225.     {
  226.         return $this->public;
  227.     }
  228.     public function setPublic(?bool $public): static
  229.     {
  230.         $this->public $public;
  231.         return $this;
  232.     }
  233.     public function getName(): ?string
  234.     {
  235.         return $this->name;
  236.     }
  237.     public function setName(?string $name): static
  238.     {
  239.         $this->name $name;
  240.         return $this;
  241.     }
  242.     public function getSlug(): ?string
  243.     {
  244.         return $this->slug;
  245.     }
  246.     public function setSlug(?string $slug): static
  247.     {
  248.         $this->slug $slug;
  249.         return $this;
  250.     }
  251.     public function getDescription(): ?string
  252.     {
  253.         return $this->description;
  254.     }
  255.     public function setDescription(?string $description): static
  256.     {
  257.         $this->description $description;
  258.         return $this;
  259.     }
  260.     public function getRecommendedUses(): ?string
  261.     {
  262.         return $this->recommended_uses;
  263.     }
  264.     public function setRecommendedUses(?string $recommended_uses): static
  265.     {
  266.         $this->recommended_uses $recommended_uses;
  267.         return $this;
  268.     }
  269.     public function getUses(): ?string
  270.     {
  271.         return $this->uses;
  272.     }
  273.     public function setUses(?string $uses): static
  274.     {
  275.         $this->uses $uses;
  276.         return $this;
  277.     }
  278.     public function getConditions(): ?string
  279.     {
  280.         return $this->conditions;
  281.     }
  282.     public function setConditions(?string $conditions): static
  283.     {
  284.         $this->conditions $conditions;
  285.         return $this;
  286.     }
  287.     public function getTools(): ?string
  288.     {
  289.         return $this->tools;
  290.     }
  291.     public function setTools(?string $tools): static
  292.     {
  293.         $this->tools $tools;
  294.         return $this;
  295.     }
  296.     public function getDilution(): ?string
  297.     {
  298.         return $this->dilution;
  299.     }
  300.     public function setDilution(?string $dilution): static
  301.     {
  302.         $this->dilution $dilution;
  303.         return $this;
  304.     }
  305.     public function getLayers(): ?string
  306.     {
  307.         return $this->layers;
  308.     }
  309.     public function setLayers(?string $layers): static
  310.     {
  311.         $this->layers $layers;
  312.         return $this;
  313.     }
  314.     public function getDryingTime(): ?string
  315.     {
  316.         return $this->drying_time;
  317.     }
  318.     public function setDryingTime(?string $drying_time): static
  319.     {
  320.         $this->drying_time $drying_time;
  321.         return $this;
  322.     }
  323.     public function getTouchDrying(): ?string
  324.     {
  325.         return $this->touch_drying;
  326.     }
  327.     public function setTouchDrying(?string $touch_drying): static
  328.     {
  329.         $this->touch_drying $touch_drying;
  330.         return $this;
  331.     }
  332.     public function getRepaintDrying(): ?string
  333.     {
  334.         return $this->repaint_drying;
  335.     }
  336.     public function setRepaintDrying(?string $repaint_drying): static
  337.     {
  338.         $this->repaint_drying $repaint_drying;
  339.         return $this;
  340.     }
  341.     public function getFinalDrying(): ?string
  342.     {
  343.         return $this->final_drying;
  344.     }
  345.     public function setFinalDrying(?string $final_drying): static
  346.     {
  347.         $this->final_drying $final_drying;
  348.         return $this;
  349.     }
  350.     public function getDataSheet(): ?string
  351.     {
  352.         return $this->data_sheet;
  353.     }
  354.     public function setDataSheet(?string $data_sheet): static
  355.     {
  356.         $this->data_sheet $data_sheet;
  357.         return $this;
  358.     }
  359.     public function getSafetySheet(): ?string
  360.     {
  361.         return $this->safety_sheet;
  362.     }
  363.     public function setSafetySheet(?string $safety_sheet): static
  364.     {
  365.         $this->safety_sheet $safety_sheet;
  366.         return $this;
  367.     }
  368.     public function getSafetySheetCb(): ?string
  369.     {
  370.         return $this->safety_sheet_cb;
  371.     }
  372.     public function setSafetySheetCb(?string $safety_sheet_cb): static
  373.     {
  374.         $this->safety_sheet_cb $safety_sheet_cb;
  375.         return $this;
  376.     }
  377.     public function getTransportSheet(): ?string
  378.     {
  379.         return $this->transport_sheet;
  380.     }
  381.     public function setTransportSheet(?string $transport_sheet): static
  382.     {
  383.         $this->transport_sheet $transport_sheet;
  384.         return $this;
  385.     }
  386.     public function getPackedColors(): ?string
  387.     {
  388.         return $this->packed_colors;
  389.     }
  390.     public function setPackedColors(?string $packed_colors): static
  391.     {
  392.         $this->packed_colors $packed_colors;
  393.         return $this;
  394.     }
  395.     public function getLinkMp(): ?string
  396.     {
  397.         return $this->link_mp;
  398.     }
  399.     public function setLinkMp(?string $link_mp): static
  400.     {
  401.         $this->link_mp $link_mp;
  402.         return $this;
  403.     }
  404.     public function getCreateAt(): ?\DateTimeInterface
  405.     {
  406.         return $this->create_at;
  407.     }
  408.     public function setCreateAt(?\DateTimeInterface $create_at): static
  409.     {
  410.         $this->create_at $create_at;
  411.         return $this;
  412.     }
  413.     public function getUpdateAt(): ?\DateTimeInterface
  414.     {
  415.         return $this->update_at;
  416.     }
  417.     public function setUpdateAt(?\DateTimeInterface $update_at): static
  418.     {
  419.         $this->update_at $update_at;
  420.         return $this;
  421.     }
  422.     public function getImage(): ?SonataMediaMedia
  423.     {
  424.         return $this->image;
  425.     }
  426.     public function setImage(?SonataMediaMedia $image): static
  427.     {
  428.         $this->image $image;
  429.         return $this;
  430.     }
  431.     public function getImageCover(): ?SonataMediaMedia
  432.     {
  433.         return $this->image_cover;
  434.     }
  435.     public function setImageCover(?SonataMediaMedia $image_cover): static
  436.     {
  437.         $this->image_cover $image_cover;
  438.         return $this;
  439.     }
  440.     public function getVideo(): ?SonataMediaMedia
  441.     {
  442.         return $this->video;
  443.     }
  444.     public function setVideo(?SonataMediaMedia $video): static
  445.     {
  446.         $this->video $video;
  447.         return $this;
  448.     }
  449.     public function getVideoImage(): ?SonataMediaMedia
  450.     {
  451.         return $this->video_image;
  452.     }
  453.     public function setVideoImage(?SonataMediaMedia $video_image): static
  454.     {
  455.         $this->video_image $video_image;
  456.         return $this;
  457.     }
  458.     /**
  459.      * @return Collection<int, ProductCategory>
  460.      */
  461.     public function getCategories(): Collection
  462.     {
  463.         return $this->categories;
  464.     }
  465.     public function addCategory(ProductCategory $category): static
  466.     {
  467.         if (!$this->categories->contains($category)) {
  468.             $this->categories->add($category);
  469.         }
  470.         return $this;
  471.     }
  472.     public function removeCategory(ProductCategory $category): static
  473.     {
  474.         $this->categories->removeElement($category);
  475.         return $this;
  476.     }
  477.     public function getSeo(): ?Seo
  478.     {
  479.         return $this->seo;
  480.     }
  481.     public function setSeo(?Seo $seo): static
  482.     {
  483.         $this->seo $seo;
  484.         return $this;
  485.     }
  486.     /**
  487.      * @return Collection<int, ProductFilter>
  488.      */
  489.     public function getFilters(): Collection
  490.     {
  491.         return $this->filters;
  492.     }
  493.     public function addFilter(ProductFilter $filter): static
  494.     {
  495.         if (!$this->filters->contains($filter)) {
  496.             $this->filters->add($filter);
  497.             $filter->setProduct($this);
  498.         }
  499.         return $this;
  500.     }
  501.     public function removeFilter(ProductFilter $filter): static
  502.     {
  503.         if ($this->filters->removeElement($filter)) {
  504.             // set the owning side to null (unless already changed)
  505.             if ($filter->getProduct() === $this) {
  506.                 $filter->setProduct(null);
  507.             }
  508.         }
  509.         return $this;
  510.     }
  511.     /**
  512.      * @return Collection<int, ProductColor>
  513.      */
  514.     public function getColors(): Collection
  515.     {
  516.         return $this->colors;
  517.     }
  518.     public function addColor(ProductColor $color): static
  519.     {
  520.         if (!$this->colors->contains($color)) {
  521.             $this->colors->add($color);
  522.             $color->setProduct($this);
  523.         }
  524.         return $this;
  525.     }
  526.     public function removeColor(ProductColor $color): static
  527.     {
  528.         if ($this->colors->removeElement($color)) {
  529.             // set the owning side to null (unless already changed)
  530.             if ($color->getProduct() === $this) {
  531.                 $color->setProduct(null);
  532.             }
  533.         }
  534.         return $this;
  535.     }
  536. }