src/Entity/Product.php line 17

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