src/Entity/CRM/DepartmentType.php line 11

  1. <?php
  2. namespace App\Entity\CRM;
  3. use App\Repository\DepartmentTypeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassDepartmentTypeRepository::class)]
  8. class DepartmentType
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\OneToMany(mappedBy'departmentType'targetEntityDepartment::class)]
  17.     private Collection $department;
  18.     #[ORM\Column(nullabletrue)]
  19.     private array $parameter = [];
  20.     public static array $typeChoices = [
  21.         '1' => 'Sprawozdania',
  22.         '2' => 'Test',
  23.     ];
  24.     #[ORM\Column(nullabletrue)]
  25.     private ?int $type null;
  26.     #[ORM\OneToMany(mappedBy'departmentType'targetEntityDepartmentTypeProductReward::class)]
  27.     private Collection $departmentTypeProductRewards;
  28.     #[ORM\Column(nullablefalse)]
  29.     private ?float $defaultReward null;
  30.     public function __construct()
  31.     {
  32.         $this->department = new ArrayCollection();
  33.         $this->departmentTypeProductRewards = new ArrayCollection();
  34.     }
  35.     public function __toString(): string
  36.     {
  37.         return $this->name;
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getName(): ?string
  44.     {
  45.         return $this->name;
  46.     }
  47.     public function setName(string $name): static
  48.     {
  49.         $this->name $name;
  50.         return $this;
  51.     }
  52.     /**
  53.      * @return Collection<int, Department>
  54.      */
  55.     public function getDepartment(): Collection
  56.     {
  57.         return $this->department;
  58.     }
  59.     public function addDepartment(Department $department): static
  60.     {
  61.         if (!$this->department->contains($department)) {
  62.             $this->department->add($department);
  63.             $department->setDepartmentType($this);
  64.         }
  65.         return $this;
  66.     }
  67.     public function removeDepartment(Department $department): static
  68.     {
  69.         if ($this->department->removeElement($department)) {
  70.             // set the owning side to null (unless already changed)
  71.             if ($department->getDepartmentType() === $this) {
  72.                 $department->setDepartmentType(null);
  73.             }
  74.         }
  75.         return $this;
  76.     }
  77.     public function getParameter(): array
  78.     {
  79.         return $this->parameter;
  80.     }
  81.     public function setParameter(?array $parameter): static
  82.     {
  83.         $this->parameter $parameter;
  84.         return $this;
  85.     }
  86.     public function getTypeChoices(): array
  87.     {
  88.         return self::$typeChoices;
  89.     }
  90.     public function getType(): ?int
  91.     {
  92.         return $this->type;
  93.     }
  94.     public function setType(?int $type): static
  95.     {
  96.         $this->type $type;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, DepartmentTypeProductReward>
  101.      */
  102.     public function getDepartmentTypeProductRewards(): Collection
  103.     {
  104.         return $this->departmentTypeProductRewards;
  105.     }
  106.     public function addDepartmentTypeProductRewards(DepartmentTypeProductReward $departmentTypeProductRewards): static
  107.     {
  108.         if (!$this->departmentTypeProductRewards->contains($departmentTypeProductRewards)) {
  109.             $this->departmentTypeProductRewards->add($departmentTypeProductRewards);
  110.             $departmentTypeProductRewards->setDepartmentType($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeDepartmentTypeProductRewards(DepartmentTypeProductReward $departmentTypeProductRewards): static
  115.     {
  116.         if ($this->departmentTypeProductRewards->removeElement($departmentTypeProductRewards)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($departmentTypeProductRewards->getDepartmentType() === $this) {
  119.                 $departmentTypeProductRewards->setDepartmentType(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     public function getDefaultReward(): ?float
  125.     {
  126.         return $this->defaultReward;
  127.     }
  128.     public function setDefaultReward(float $defaultReward): static
  129.     {
  130.         $this->defaultReward $defaultReward;
  131.         return $this;
  132.     }
  133. }