src/Entity/System/Group.php line 19

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Toni Peral <toniperal.a4b@gmail.com>
  5.  * Date: 12/11/20
  6.  * Time: 11:55
  7.  */
  8. namespace App\Entity\System;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * @ORM\Entity(repositoryClass="App\Repository\System\GroupRepository")
  13.  *
  14.  * @ORM\Table(name="ps_group")
  15.  */
  16. class Group
  17. {
  18.     public const GROUP_ID_GENERAL 1;
  19.     public const GROUP_ID_WHOLESALER 2;
  20.     public const GROUP_ID_EMPLOYEE 3;
  21.     /**
  22.      * @var int
  23.      *
  24.      * @ORM\Id
  25.      *
  26.      * @ORM\GeneratedValue(strategy="AUTO")
  27.      *
  28.      * @ORM\Column(type="integer", name="id_group")
  29.      */
  30.     private $id;
  31.     /**
  32.      * @var string
  33.      *
  34.      * @ORM\Column(type="string", length=32)
  35.      */
  36.     private $name;
  37.     /**
  38.      * @var Customer[]|ArrayCollection
  39.      *
  40.      * @ORM\OneToMany(targetEntity="Customer", mappedBy="group")
  41.      */
  42.     private $customers;
  43.     /**
  44.      * @var SubscriptionLine[]|ArrayCollection
  45.      *
  46.      * @ORM\OneToMany(targetEntity="SubscriptionLine", mappedBy="group", cascade={"persist"})
  47.      */
  48.     private $subscriptionLines;
  49.     public function __construct()
  50.     {
  51.         $this->customers = new ArrayCollection();
  52.         $this->subscriptionLines = new ArrayCollection();
  53.     }
  54.     /**
  55.      * @return int
  56.      */
  57.     public function getId(): int
  58.     {
  59.         return $this->id;
  60.     }
  61.     /**
  62.      * @param int $id
  63.      *
  64.      * @return Group
  65.      */
  66.     public function setId(int $id): self
  67.     {
  68.         $this->id $id;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return string
  73.      */
  74.     public function getName(): string
  75.     {
  76.         return $this->name;
  77.     }
  78.     /**
  79.      * @param string $name
  80.      *
  81.      * @return Group
  82.      */
  83.     public function setName(string $name): self
  84.     {
  85.         $this->name $name;
  86.         return $this;
  87.     }
  88.     /**
  89.      * @return Customer[]|ArrayCollection
  90.      */
  91.     public function getCustomers(): array
  92.     {
  93.         return $this->customers;
  94.     }
  95.     /**
  96.      * @param Customer[]|ArrayCollection $customers
  97.      *
  98.      * @return Group
  99.      */
  100.     public function setCustomers(array $customers): self
  101.     {
  102.         $this->customers $customers;
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return SubscriptionLine[]|ArrayCollection
  107.      */
  108.     public function getSubscriptionLines(): array
  109.     {
  110.         return $this->subscriptionLines;
  111.     }
  112.     /**
  113.      * @param SubscriptionLine[]|ArrayCollection $subscriptionLines
  114.      *
  115.      * @return Group
  116.      */
  117.     public function setSubscriptionLines(array $subscriptionLines): self
  118.     {
  119.         $this->subscriptionLines $subscriptionLines;
  120.         return $this;
  121.     }
  122. }