src/Entity/Commission.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CommissionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=CommissionRepository::class)
  9.  */
  10. class Commission
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $commission_name;
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private $amount_month;
  26.     /**
  27.      * @ORM\Column(type="decimal", precision=10, scale=3)
  28.      */
  29.     private $amount_percentage;
  30.     /**
  31.      * @ORM\Column(type="integer", nullable=true)
  32.      */
  33.     private $reg_by;
  34.     /**
  35.      * @ORM\Column(type="datetime", nullable=true)
  36.      */
  37.     private $reg_datetime;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=User::class, mappedBy="commission")
  40.      */
  41.     private $users;
  42.     /**
  43.      * @ORM\Column(type="boolean")
  44.      */
  45.     private $is_active;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=SalesCommission::class, mappedBy="commission")
  48.      */
  49.     private $salesCommissions;
  50.     public function __construct()
  51.     {
  52.         $this->users = new ArrayCollection();
  53.         $this->salesCommissions = new ArrayCollection();
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getCommissionName(): ?string
  60.     {
  61.         return $this->commission_name;
  62.     }
  63.     public function setCommissionName(string $commission_name): self
  64.     {
  65.         $this->commission_name $commission_name;
  66.         return $this;
  67.     }
  68.     public function getAmountMonth(): ?int
  69.     {
  70.         return $this->amount_month;
  71.     }
  72.     public function setAmountMonth(int $amount_month): self
  73.     {
  74.         $this->amount_month $amount_month;
  75.         return $this;
  76.     }
  77.     public function getAmountPercentage(): ?string
  78.     {
  79.         return $this->amount_percentage;
  80.     }
  81.     public function setAmountPercentage(string $amount_percentage): self
  82.     {
  83.         $this->amount_percentage $amount_percentage;
  84.         return $this;
  85.     }
  86.     public function getRegBy(): ?int
  87.     {
  88.         return $this->reg_by;
  89.     }
  90.     public function setRegBy(?int $reg_by): self
  91.     {
  92.         $this->reg_by $reg_by;
  93.         return $this;
  94.     }
  95.     public function getRegDatetime(): ?\DateTimeInterface
  96.     {
  97.         return $this->reg_datetime;
  98.     }
  99.     public function setRegDatetime(?\DateTimeInterface $reg_datetime): self
  100.     {
  101.         $this->reg_datetime $reg_datetime;
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection<int, User>
  106.      */
  107.     public function getUsers(): Collection
  108.     {
  109.         return $this->users;
  110.     }
  111.     public function addUser(User $user): self
  112.     {
  113.         if (!$this->users->contains($user)) {
  114.             $this->users[] = $user;
  115.             $user->setCommission($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeUser(User $user): self
  120.     {
  121.         if ($this->users->removeElement($user)) {
  122.             // set the owning side to null (unless already changed)
  123.             if ($user->getCommission() === $this) {
  124.                 $user->setCommission(null);
  125.             }
  126.         }
  127.         return $this;
  128.     }
  129.     public function __toString()
  130.     {
  131.         return $this->getCommissionName();
  132.     }
  133.     public function isIsActive(): ?bool
  134.     {
  135.         return $this->is_active;
  136.     }
  137.     public function setIsActive(bool $is_active): self
  138.     {
  139.         $this->is_active $is_active;
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Collection<int, SalesCommission>
  144.      */
  145.     public function getSalesCommissions(): Collection
  146.     {
  147.         return $this->salesCommissions;
  148.     }
  149.     public function addSalesCommission(SalesCommission $salesCommission): self
  150.     {
  151.         if (!$this->salesCommissions->contains($salesCommission)) {
  152.             $this->salesCommissions[] = $salesCommission;
  153.             $salesCommission->setCommission($this);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeSalesCommission(SalesCommission $salesCommission): self
  158.     {
  159.         if ($this->salesCommissions->removeElement($salesCommission)) {
  160.             // set the owning side to null (unless already changed)
  161.             if ($salesCommission->getCommission() === $this) {
  162.                 $salesCommission->setCommission(null);
  163.             }
  164.         }
  165.         return $this;
  166.     }
  167. }