app/proxy/entity/app/Plugin/CustomerGroup42/Entity/Group.php line 36

Open in your IDE?
  1. <?php
  2. /**
  3.  * This file is part of CustomerGroup42
  4.  *
  5.  * Copyright(c) Akira Kurozumi <info@a-zumi.net>
  6.  *
  7.  * https://a-zumi.net
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Plugin\CustomerGroup42\Entity;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Eccube\Entity\AbstractEntity;
  17. use Eccube\Entity\Category;
  18. use Eccube\Entity\Customer;
  19. use Eccube\Entity\Page;
  20. use Eccube\Entity\Product;
  21.     /**
  22.      * Class Group
  23.      * @package Plugin\CustomerGroup42\Entity
  24.      *
  25.      * @ORM\Table(name="plg_customer_group")
  26.      * @ORM\InheritanceType("SINGLE_TABLE")
  27.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  28.      * @ORM\HasLifecycleCallbacks()
  29.      * @ORM\Entity(repositoryClass="Plugin\CustomerGroup42\Repository\GroupRepository")
  30.      */
  31.     class Group extends AbstractEntity
  32.     {
  33.     use \Plugin\CustomerGroupPrice42\Entity\GroupTrait;
  34.         /**
  35.          * @var int
  36.          *
  37.          * @ORM\Column(type="integer", options={"unsigned":true})
  38.          * @ORM\Id()
  39.          * @ORM\GeneratedValue(strategy="IDENTITY")
  40.          */
  41.         private $id;
  42.         /**
  43.          * @var string
  44.          *
  45.          * @ORM\Column(type="string", length=255)
  46.          */
  47.         private $name;
  48.         /**
  49.          * @var string
  50.          *
  51.          * @ORM\Column(type="string", length=255, nullable=true)
  52.          */
  53.         private $backendName;
  54.         /**
  55.          * @var bool
  56.          *
  57.          * @ORM\Column(type="boolean", options={"default":false})
  58.          */
  59.         private $optionNonMemberDisplay;
  60.         /**
  61.          * @var int
  62.          *
  63.          * @ORM\Column(type="smallint", nullable=true, options={"unsigned":true})
  64.          */
  65.         private $sortNo;
  66.         /**
  67.          * @var Collection
  68.          *
  69.          * @ORM\ManyToMany(targetEntity="Eccube\Entity\Customer", mappedBy="groups")
  70.          */
  71.         private $customers;
  72.         /**
  73.          * @var Collection
  74.          *
  75.          * @ORM\ManyToMany(targetEntity="Eccube\Entity\Product", mappedBy="groups")
  76.          */
  77.         private $products;
  78.         /**
  79.          * @var Collection
  80.          *
  81.          * @ORM\ManyToMany(targetEntity="Eccube\Entity\Category", mappedBy="groups")
  82.          */
  83.         private $categories;
  84.         /**
  85.          * @var Collection
  86.          *
  87.          * @ORM\ManyToMany(targetEntity="Eccube\Entity\Page", mappedBy="groups")
  88.          */
  89.         private $pages;
  90.         public function __construct()
  91.         {
  92.             $this->customers = new ArrayCollection();
  93.             $this->products = new ArrayCollection();
  94.             $this->categories = new ArrayCollection();
  95.             $this->pages = new ArrayCollection();
  96.         }
  97.         public function __toString(): string
  98.         {
  99.             return $this->name;
  100.         }
  101.         /**
  102.          * @return int|null
  103.          */
  104.         public function getId(): ?int
  105.         {
  106.             return $this->id;
  107.         }
  108.         /**
  109.          * @return string|null
  110.          */
  111.         public function getName(): ?string
  112.         {
  113.             return $this->name;
  114.         }
  115.         /**
  116.          * @param string $name
  117.          * @return $this
  118.          */
  119.         public function setName(string $name): self
  120.         {
  121.             $this->name $name;
  122.             return $this;
  123.         }
  124.         /**
  125.          * @return string|null
  126.          */
  127.         public function getBackendName(): ?string
  128.         {
  129.             return $this->backendName;
  130.         }
  131.         /**
  132.          * @param string $backendName
  133.          * @return $this
  134.          */
  135.         public function setBackendName(string $backendName): self
  136.         {
  137.             $this->backendName $backendName;
  138.             return $this;
  139.         }
  140.         /**
  141.          * @return bool|null
  142.          */
  143.         public function isOptionNonMemberDisplay(): ?bool
  144.         {
  145.             return $this->optionNonMemberDisplay;
  146.         }
  147.         /**
  148.          * @param bool $optionNonMemberDisplay
  149.          * @return $this
  150.          */
  151.         public function setOptionNonMemberDisplay(bool $optionNonMemberDisplay): self
  152.         {
  153.             $this->optionNonMemberDisplay $optionNonMemberDisplay;
  154.             return $this;
  155.         }
  156.         /**
  157.          * @return int
  158.          */
  159.         public function getSortNo(): int
  160.         {
  161.             return $this->sortNo;
  162.         }
  163.         /**
  164.          * @param int $sortNo
  165.          * @return $this
  166.          */
  167.         public function setSortNo(int $sortNo): self
  168.         {
  169.             $this->sortNo $sortNo;
  170.             return $this;
  171.         }
  172.         /**
  173.          * @return Collection
  174.          */
  175.         public function getCustomers(): Collection
  176.         {
  177.             return $this->customers;
  178.         }
  179.         /**
  180.          * @param Customer $customer
  181.          * @return $this
  182.          */
  183.         public function addCustomer(Customer $customer): self
  184.         {
  185.             if (false === $this->customers->contains($customer)) {
  186.                 $this->customers->add($customer);
  187.             }
  188.             return $this;
  189.         }
  190.         /**
  191.          * @param Customer $customer
  192.          * @return $this
  193.          */
  194.         public function removeCustomer(Customer $customer): self
  195.         {
  196.             if ($this->customers->contains($customer)) {
  197.                 $this->customers->removeElement($customer);
  198.             }
  199.             return $this;
  200.         }
  201.         /**
  202.          * @return Collection
  203.          */
  204.         public function getProducts(): Collection
  205.         {
  206.             return $this->products;
  207.         }
  208.         /**
  209.          * @param Product $product
  210.          * @return $this
  211.          */
  212.         public function addProduct(Product $product): self
  213.         {
  214.             if (false === $this->products->contains($product)) {
  215.                 $this->products->add($product);
  216.             }
  217.             return $this;
  218.         }
  219.         /**
  220.          * @param Product $product
  221.          * @return $this
  222.          */
  223.         public function removeProduct(Product $product): self
  224.         {
  225.             if ($this->products->contains($product)) {
  226.                 $this->products->removeElement($product);
  227.             }
  228.             return $this;
  229.         }
  230.         /**
  231.          * @return Collection
  232.          */
  233.         public function getCategories(): Collection
  234.         {
  235.             return $this->categories;
  236.         }
  237.         /**
  238.          * @param Category $category
  239.          * @return $this
  240.          */
  241.         public function addCategory(Category $category): self
  242.         {
  243.             if (false === $this->categories->contains($category)) {
  244.                 $this->categories->add($category);
  245.             }
  246.             return $this;
  247.         }
  248.         /**
  249.          * @param Category $category
  250.          * @return $this
  251.          */
  252.         public function removeCategory(Category $category): self
  253.         {
  254.             if ($this->categories->contains($category)) {
  255.                 $this->categories->removeElement($category);
  256.             }
  257.             return $this;
  258.         }
  259.         /**
  260.          * @return Collection
  261.          */
  262.         public function getPages(): Collection
  263.         {
  264.             return $this->pages;
  265.         }
  266.         /**
  267.          * @param Page $page
  268.          * @return $this
  269.          */
  270.         public function addPage(Page $page): self
  271.         {
  272.             if (false === $this->pages->contains($page)) {
  273.                 $this->pages->add($page);
  274.             }
  275.             return $this;
  276.         }
  277.         /**
  278.          * @param Page $page
  279.          * @return $this
  280.          */
  281.         public function removePage(Page $page): self
  282.         {
  283.             if ($this->pages->contains($page)) {
  284.                 $this->pages->removeElement($page);
  285.             }
  286.             return $this;
  287.         }
  288.     }