src/Entity/Category.php line 48

Open in your IDE?
  1. <?php
  2. /**
  3.  * Product class represents model of Category entity
  4.  *
  5.  * $Project: Alliancemarkets2 $
  6.  * $Id$
  7.  *
  8.  * @package alliancemarkets2
  9.  * @author George Matyas <webexciter@yahoo.com>
  10.  * @version $Revision$
  11.  */
  12. // src/AppBundle/Entity/Category.php
  13. namespace App\Entity;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Doctrine\Common\Collections\Collection;
  16. use Doctrine\DBAL\Types\Types;
  17. /*
  18. use Gedmo\Mapping\Annotation\Tree; 
  19. */
  20. use Doctrine\ORM\Mapping as ORM;
  21. use Gedmo\Mapping\Annotation as Gedmo;
  22. use Gedmo\Translatable\Translatable;
  23. use App\Entity\Eshop;
  24. /*
  25. @Gedmo\Mapping\Annotation\Tree(type="nested")
  26. @Doctrine\ORM\Mapping\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
  27. ORM\Entity(repositoryClass="App\EntityRepo\CategoryRepo")
  28. */
  29. /**
  30.  * 
  31.  * 
  32.  * 
  33.  * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
  34.  * @ORM\Table(name="category")
  35.  * @Gedmo\TranslationEntity(class="App\Entity\CategoryTranslation")
  36.  * @Gedmo\Tree(type="nested")
  37.  * 
  38.  * Doctrine\ORM\Mapping\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository")
  39.  * 
  40.  */
  41. class Category implements Translatable
  42. {
  43.     /**
  44.      * @ORM\Column(type="integer")
  45.      * @ORM\Id
  46.      * @ORM\GeneratedValue(strategy="AUTO")
  47.      */ 
  48.     private $categoryId=0;
  49.     /**
  50.      * @ORM\Column(type="string", length=255, nullable=true)
  51.      */
  52.     protected $categoryKey;
  53.     
  54.     /**
  55.      * @Gedmo\Translatable
  56.      * @ORM\Column(type="string", length=100, nullable=true)
  57.      */
  58.     protected $categoryName;
  59.     /**
  60.      * @Gedmo\Translatable
  61.      * @ORM\Column(type="text", nullable=true)
  62.      */
  63.     protected $categoryDescription;    
  64.     
  65.     /**
  66.      * Post locale
  67.      * Used locale to override Translation listener's locale
  68.      *
  69.      * @Gedmo\Locale
  70.      *
  71.      */
  72.     protected $locale;
  73.     
  74.     /**
  75.      * Assert\Image( maxSize = "3072k", mimeTypesMessage = "Please upload a valid Image")
  76.      *
  77.      * @ORM\Column(type="string", length=255, nullable=true)
  78.      */
  79.     protected $image1;    
  80.     
  81.     
  82.     /*
  83.      * Many Products have Many Prices.
  84.      * @ORM\ManyToMany(targetEntity="Price")
  85.      * @ORM\JoinTable(name="product_price",
  86.      *      joinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="product_id")},
  87.      *      inverseJoinColumns={@ORM\JoinColumn(name="price_id", referencedColumnName="price_id", unique=false)}
  88.      *      )
  89.      */    
  90.     
  91.     
  92.     /*
  93.      * Doctrine\ORM\Mapping\ManyToOne(targetEntity="Category")
  94.      * Doctrine\ORM\Mapping\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
  95.      * 
  96.      * @Gedmo\TreeParent
  97.      * @Doctrine\ORM\Mapping\ManyToOne(targetEntity="Category")
  98.      * @Doctrine\ORM\Mapping\JoinColumn(name="parent", referencedColumnName="parent", onDelete="CASCADE")
  99.      * 
  100.      * @Gedmo\TreeParent
  101.      * @ORM\ManyToMany(targetEntity="Category")
  102.      * @ORM\JoinTable(name="category_category",
  103.      *      joinColumns={@ORM\JoinColumn(name="category_id", referencedColumnName="category_id")},
  104.      *      inverseJoinColumns={@ORM\JoinColumn(name="parent_id", referencedColumnName="parent_id", unique=false)}
  105.      *      ) 
  106.      */
  107.     
  108.     /* 
  109.      * @Gedmo\TreeParent
  110.      * @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
  111.      * @ORM\JoinColumn(name="parent_id", referencedColumnName="category_id", onDelete="SET NULL")
  112.      * 
  113.      */ 
  114.    
  115.     /**
  116.      * @Gedmo\TreeRoot
  117.      * @ORM\ManyToOne(targetEntity="Category")
  118.      * @ORM\JoinColumn(referencedColumnName="category_id", onDelete="CASCADE")
  119.      */
  120.     protected $root;    
  121.     
  122.     /**
  123.      * @Gedmo\TreeParent
  124.      * @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
  125.      * @ORM\JoinColumn(name="parent_id", referencedColumnName="category_id", onDelete="SET NULL")    
  126.      */    
  127.     protected $parent
  128.     
  129.     /*
  130.      * @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
  131.      */
  132.     
  133.     /**
  134.      * @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
  135.      * @ORM\OrderBy({"lft" = "ASC"})
  136.      */    
  137.     protected $children;    
  138.     /**
  139.      * @Gedmo\TreeLeft
  140.      * @Doctrine\ORM\Mapping\Column(type="integer", nullable=true)
  141.      */
  142.     protected $lft
  143.     
  144.     /**
  145.      * @Gedmo\TreeLevel
  146.      * @ORM\Column(name="lvl", type="integer")
  147.      */
  148.     protected $lvl;    
  149.     
  150.     /**
  151.      * @Gedmo\TreeRight
  152.      * @Doctrine\ORM\Mapping\Column(type="integer", nullable=true)
  153.      */
  154.     protected $rgt;     
  155.       
  156.      /**
  157.       * @ORM\Column(type="integer")
  158.       */
  159.      protected $eshopId;  
  160.     /**
  161.      * @ORM\Column(type="string", length=100, nullable=true)
  162.      */    
  163.     protected $ERPKey;       
  164.     /**
  165.      * @ORM\Column(type="boolean", options={"default":"1"})
  166.      */    
  167.     protected $isActive;     
  168.     /**
  169.      * @ORM\Column(type="boolean", options={"default":"0"}, nullable=true)
  170.      */    
  171.     protected $isHidden;  
  172.     /**
  173.      * @ORM\Column(type="integer", nullable=true)
  174.      */
  175.     protected $imageThumbWidth=100;    
  176.     /**
  177.      * @ORM\Column(type="integer", nullable=true)
  178.      */
  179.     protected $imageThumbHeight=100;  
  180.      /**
  181.       * @ORM\Column(type="integer", nullable=true)
  182.       */
  183.      protected $auctionHallId;  
  184.     /**
  185.      * @ORM\Column(type="integer", nullable=true)
  186.      */
  187.     protected $marketplaceDepartmentId=0;                             
  188.     /**
  189.      * Get categoryId
  190.      *
  191.      * @return integer
  192.      */
  193.     public function getCategoryId()
  194.     {
  195.         return $this->categoryId;
  196.     }
  197.     /**
  198.      * Set categoryKey
  199.      *
  200.      * @param string $categoryKey
  201.      *
  202.      * @return Category
  203.      */
  204.     public function setCategoryKey($categoryKey)
  205.     {
  206.         $this->categoryKey $categoryKey;
  207.         return $this;
  208.     }
  209.     /**
  210.      * Get categoryKey
  211.      *
  212.      * @return string
  213.      */
  214.     public function getCategoryKey()
  215.     {
  216.         return $this->categoryKey;
  217.     }
  218.     /**
  219.      * Set categoryName
  220.      *
  221.      * @param string $categoryName
  222.      *
  223.      * @return Category
  224.      */
  225.     public function setCategoryName($categoryName)
  226.     {
  227.         $this->categoryName $categoryName;
  228.         return $this;
  229.     }
  230.     /**
  231.      * Get categoryName
  232.      *
  233.      * @return string
  234.      */
  235.     public function getCategoryName()
  236.     {
  237.         return $this->categoryName;
  238.     }
  239.     /**
  240.      * Set image1
  241.      *
  242.      * @param string $image1
  243.      *
  244.      * @return Category
  245.      */
  246.     public function setImage1($image1)
  247.     {
  248.         $this->image1 $image1;
  249.         return $this;
  250.     }
  251.     /**
  252.      * Get image1
  253.      *
  254.      * @return string
  255.      */
  256.     public function getImage1()
  257.     {
  258.         return $this->image1;
  259.     }
  260.     
  261.     /**
  262.      * Set locale
  263.      *
  264.      * @param string $locale
  265.      *
  266.      * @return Product
  267.      */
  268.     public function setLocale($locale)
  269.     {
  270.         $this->locale $locale;
  271.     
  272.         return $this;
  273.     }
  274.     
  275.     /**
  276.      * Get locale
  277.      *
  278.      * @return string
  279.      */
  280.     public function getLocale()
  281.     {
  282.         return $this->locale;
  283.     }    
  284.     
  285.     /**
  286.      * Constructor
  287.      */
  288.     public function __construct()
  289.     {
  290.         $this->parent = new \Doctrine\Common\Collections\ArrayCollection();
  291.         $this->children = new ArrayCollection();
  292.     }
  293.     /**
  294.      * Set lft
  295.      *
  296.      * @param integer $lft
  297.      *
  298.      * @return Category
  299.      */
  300.     public function setLft($lft)
  301.     {
  302.         $this->lft $lft;
  303.         return $this;
  304.     }
  305.     /**
  306.      * Get lft
  307.      *
  308.      * @return integer
  309.      */
  310.     public function getLft()
  311.     {
  312.         return $this->lft;
  313.     }
  314.     /**
  315.      * Set rgt
  316.      *
  317.      * @param integer $rgt
  318.      *
  319.      * @return Category
  320.      */
  321.     public function setRgt($rgt)
  322.     {
  323.         $this->rgt $rgt;
  324.         return $this;
  325.     }
  326.     /**
  327.      * Get rgt
  328.      *
  329.      * @return integer
  330.      */
  331.     public function getRgt()
  332.     {
  333.         return $this->rgt;
  334.     }
  335.     /**
  336.      * Add parent
  337.      *
  338.      * @param \App\Entity\Category $parent
  339.      *
  340.      * @return Category
  341.      */
  342.     public function addParent(\App\Entity\Category $parent)
  343.     {
  344.         $this->parent[] = $parent;
  345.         return $this;
  346.     }
  347.     /**
  348.      * Remove parent
  349.      *
  350.      * @param \App\Entity\Category $parent
  351.      */
  352.     public function removeParent(\App\Entity\Category $parent)
  353.     {
  354.         $this->parent->removeElement($parent);
  355.     }
  356.     /**
  357.      * Get parent
  358.      *
  359.      * @return \Doctrine\Common\Collections\Collection
  360.      */
  361.     public function getParent()
  362.     {
  363.         return $this->parent;
  364.     }
  365.     /**
  366.      * Set parent
  367.      *
  368.      * @param \App\Entity\Category $parent
  369.      *
  370.      * @return Category
  371.      */
  372.     public function setParent(\App\Entity\Category $parent null)
  373.     {
  374.         $this->parent $parent;
  375.         return $this;
  376.     }
  377.     /**
  378.      * Add child
  379.      *
  380.      * @param \App\Entity\Category $child
  381.      *
  382.      * @return Category
  383.      */
  384.     public function addChild(\App\Entity\Category $child)
  385.     {
  386.         $this->children[] = $child;
  387.         return $this;
  388.     }
  389.     /**
  390.      * Remove child
  391.      *
  392.      * @param \App\Entity\Category $child
  393.      */
  394.     public function removeChild(\App\Entity\Category $child)
  395.     {
  396.         $this->children->removeElement($child);
  397.     }
  398.     /**
  399.      * Get children
  400.      *
  401.      * @return \Doctrine\Common\Collections\Collection
  402.      */
  403.     public function getChildren()
  404.     {
  405.         return $this->children;
  406.     }
  407.     /**
  408.      * Set lvl
  409.      *
  410.      * @param integer $lvl
  411.      *
  412.      * @return Category
  413.      */
  414.     public function setLvl($lvl)
  415.     {
  416.         $this->lvl $lvl;
  417.         return $this;
  418.     }
  419.     /**
  420.      * Get lvl
  421.      *
  422.      * @return integer
  423.      */
  424.     public function getLvl()
  425.     {
  426.         return $this->lvl;
  427.     }
  428.     /**
  429.      * Set root
  430.      *
  431.      * @param \App\Entity\Category $root
  432.      *
  433.      * @return Category
  434.      */
  435.     public function setRoot(\App\Entity\Category $root null)
  436.     {
  437.         $this->root $root;
  438.         return $this;
  439.     }
  440.     /**
  441.      * Get root
  442.      *
  443.      * @return \App\Entity\Category
  444.      */
  445.     public function getRoot()
  446.     {
  447.         return $this->root;
  448.     }
  449.     /**
  450.      * Set eshop
  451.      *
  452.      * @param \App\Entity\Eshop $eshop
  453.      *
  454.      * @return Category
  455.      */
  456.     public function setEshop(\App\Entity\Eshop $eshop null)
  457.     {
  458.         $this->eshop $eshop;
  459.         return $this;
  460.     }
  461.     /**
  462.      * Get eshop
  463.      *
  464.      * @return \App\Entity\Eshop
  465.      */
  466.     public function getEshop()
  467.     {
  468.         return $this->eshop;
  469.     }
  470.     /**
  471.      * Add eshop
  472.      *
  473.      * @param \App\Entity\Eshop $eshop
  474.      *
  475.      * @return Category
  476.      */
  477.     public function addEshop(\App\Entity\Eshop $eshop)
  478.     {
  479.         $this->eshop[] = $eshop;
  480.         return $this;
  481.     }
  482.     /**
  483.      * Remove eshop
  484.      *
  485.      * @param \App\Entity\Eshop $eshop
  486.      */
  487.     public function removeEshop(\App\Entity\Eshop $eshop)
  488.     {
  489.         $this->eshop->removeElement($eshop);
  490.     }
  491.     /**
  492.      * Add eshop2
  493.      *
  494.      * @param \App\Entity\Eshop $eshop2
  495.      *
  496.      * @return Category
  497.      */
  498.     public function addEshop2(\App\Entity\Eshop $eshop2)
  499.     {
  500.         $this->eshop2[] = $eshop2;
  501.         return $this;
  502.     }
  503.     /**
  504.      * Remove eshop2
  505.      *
  506.      * @param \App\Entity\Eshop $eshop2
  507.      */
  508.     public function removeEshop2(\App\Entity\Eshop $eshop2)
  509.     {
  510.         $this->eshop2->removeElement($eshop2);
  511.     }
  512.     /**
  513.      * Get eshop2
  514.      *
  515.      * @return \Doctrine\Common\Collections\Collection
  516.      */
  517.     public function getEshop2()
  518.     {
  519.         return $this->eshop2;
  520.     }
  521.     /**
  522.      * Set eshopId
  523.      *
  524.      * @param integer $eshopId
  525.      *
  526.      * @return Category
  527.      */
  528.     public function setEshopId($eshopId)
  529.     {
  530.         $this->eshopId $eshopId;
  531.         return $this;
  532.     }
  533.     /**
  534.      * Get eshopId
  535.      *
  536.      * @return integer
  537.      */
  538.     public function getEshopId()
  539.     {
  540.         return $this->eshopId;
  541.     }
  542.     /**
  543.      * Set categoryDescription
  544.      *
  545.      * @param string $categoryDescription
  546.      *
  547.      * @return Category
  548.      */
  549.     public function setCategoryDescription($categoryDescription)
  550.     {
  551.         $this->categoryDescription $categoryDescription;
  552.         return $this;
  553.     }
  554.     /**
  555.      * Get categoryDescription
  556.      *
  557.      * @return string
  558.      */
  559.     public function getCategoryDescription()
  560.     {
  561.         return $this->categoryDescription;
  562.     }
  563.     /**
  564.      * Set eRPKey
  565.      *
  566.      * @param string $eRPKey
  567.      *
  568.      * @return Category
  569.      */
  570.     public function setERPKey($eRPKey)
  571.     {
  572.         $this->ERPKey $eRPKey;
  573.         return $this;
  574.     }
  575.     /**
  576.      * Get eRPKey
  577.      *
  578.      * @return string
  579.      */
  580.     public function getERPKey()
  581.     {
  582.         return $this->ERPKey;
  583.     }
  584.     /**
  585.      * Set isActive
  586.      *
  587.      * @param boolean $isActive
  588.      *
  589.      * @return Category
  590.      */
  591.     public function setIsActive($isActive)
  592.     {
  593.         $this->isActive $isActive;
  594.         return $this;
  595.     }
  596.     /**
  597.      * Get isActive
  598.      *
  599.      * @return boolean
  600.      */
  601.     public function getIsActive()
  602.     {
  603.         return $this->isActive;
  604.     }
  605.     /**
  606.      * Set isHidden
  607.      *
  608.      * @param boolean $isHidden
  609.      *
  610.      * @return Category
  611.      */
  612.     public function setIsHidden($isHidden)
  613.     {
  614.         $this->isHidden $isHidden;
  615.         return $this;
  616.     }
  617.     /**
  618.      * Get isHidden
  619.      *
  620.      * @return boolean
  621.      */
  622.     public function getIsHidden()
  623.     {
  624.         return $this->isHidden;
  625.     }
  626.     /**
  627.      * Set imageThumbWidth
  628.      *
  629.      * @param integer $imageThumbWidth
  630.      *
  631.      * @return Category
  632.      */
  633.     public function setImageThumbWidth($imageThumbWidth)
  634.     {
  635.         $this->imageThumbWidth $imageThumbWidth;
  636.         return $this;
  637.     }
  638.     /**
  639.      * Get imageThumbWidth
  640.      *
  641.      * @return integer
  642.      */
  643.     public function getImageThumbWidth()
  644.     {
  645.         return $this->imageThumbWidth;
  646.     }
  647.     /**
  648.      * Set imageThumbHeight
  649.      *
  650.      * @param integer $imageThumbHeight
  651.      *
  652.      * @return Category
  653.      */
  654.     public function setImageThumbHeight($imageThumbHeight)
  655.     {
  656.         $this->imageThumbHeight $imageThumbHeight;
  657.         return $this;
  658.     }
  659.     /**
  660.      * Get imageThumbHeight
  661.      *
  662.      * @return integer
  663.      */
  664.     public function getImageThumbHeight()
  665.     {
  666.         return $this->imageThumbHeight;
  667.     }
  668.     /**
  669.      * Set auctionHallId
  670.      *
  671.      * @param integer $auctionHallId
  672.      *
  673.      * @return Category
  674.      */
  675.     public function setAuctionHallId($auctionHallId)
  676.     {
  677.         $this->auctionHallId $auctionHallId;
  678.         return $this;
  679.     }
  680.     /**
  681.      * Get auctionHallId
  682.      *
  683.      * @return integer
  684.      */
  685.     public function getAuctionHallId()
  686.     {
  687.         return $this->auctionHallId;
  688.     }
  689.     /**
  690.      * Set marketplaceDepartmentId
  691.      *
  692.      * @param integer $marketplaceDepartmentId
  693.      *
  694.      * @return Category
  695.      */
  696.     public function setMarketplaceDepartmentId($marketplaceDepartmentId)
  697.     {
  698.         $this->marketplaceDepartmentId $marketplaceDepartmentId;
  699.         return $this;
  700.     }
  701.     /**
  702.      * Get marketplaceDepartmentId
  703.      *
  704.      * @return integer
  705.      */
  706.     public function getMarketplaceDepartmentId()
  707.     {
  708.         return $this->marketplaceDepartmentId;
  709.     }
  710.     public function isIsActive(): ?bool
  711.     {
  712.         return $this->isActive;
  713.     }
  714.     public function isIsHidden(): ?bool
  715.     {
  716.         return $this->isHidden;
  717.     }
  718. }