src/Entity/Certificates.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CertificatesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CertificatesRepository::class)
  10.  */
  11. class Certificates
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      * @Groups({
  18.      *     "certificates.base",
  19.      *     "customer.certificate.manage",
  20.      *     "customer.manage.base",
  21.      *     "project.certificates",
  22.      *     "customer.joined.projects.depended.certificates",
  23.      *     "stakeholder.selected.core.project.manage",
  24.      *     "worker.manage.base",
  25.      *     "worker.certificate.manage",
  26.      *     "selected.customer.project.for.worker"
  27.      * })
  28.      */
  29.     private $id;
  30.     /**
  31.      * @ORM\Column(type="string", length=255)
  32.      * @Groups({
  33.      *     "certificates.base",
  34.      *     "customer.certificate.manage",
  35.      *     "customer.manage.base",
  36.      *     "project.certificates",
  37.      *     "customer.joined.projects.depended.certificates",
  38.      *     "stakeholder.selected.core.project.manage",
  39.      *     "worker.manage.base",
  40.      *     "worker.certificate.manage",
  41.      *     "selected.customer.project.for.worker"
  42.      * })
  43.      */
  44.     private $name;
  45.     /**
  46.      * @ORM\Column(type="string", length=255)
  47.      * @Groups({
  48.      *     "certificates.base",
  49.      *     "customer.manage.base",
  50.      *     "project.certificates",
  51.      *     "customer.joined.projects.depended.certificates",
  52.      *     "stakeholder.selected.core.project.manage",
  53.      *     "worker.manage.base",
  54.      *     "worker.certificate.manage",
  55.      *     "selected.customer.project.for.worker"
  56.      * })
  57.      */
  58.     private $color;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=WorkerCertificates::class, mappedBy="certificate")
  61.      */
  62.     private $workerCertificates;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=CertificatesGroups::class, inversedBy="certificates")
  65.      * @ORM\JoinColumn(nullable=false)
  66.      * @Groups({
  67.      *        "certificate.group.base",
  68.      *    })
  69.      */
  70.     private $groups;
  71.     /**
  72.      * @ORM\OneToMany(targetEntity=CustomerCertificates::class, mappedBy="certificate")
  73.      */
  74.     private $customerCertificates;
  75.     /**
  76.      * @ORM\ManyToMany(targetEntity=ProjectStakeholders::class, mappedBy="dependent_certificates")
  77.      */
  78.     private $projectStakeholders;
  79.     /**
  80.      * @ORM\ManyToMany(targetEntity=Projects::class, mappedBy="dependent_certificates")
  81.      */
  82.     private $projects;
  83.     /**
  84.      * @ORM\ManyToOne(targetEntity=CertificateEligibilities::class, inversedBy="certificates")
  85.      * @Groups({"certificates.base", "project.certificates", "customer.joined.projects.depended.certificates.eligibility"})
  86.      */
  87.     private $certificate_eligibility;
  88.     public function __construct()
  89.     {
  90.         $this->workerCertificates = new ArrayCollection();
  91.         $this->customerCertificates = new ArrayCollection();
  92.         $this->projectStakeholders = new ArrayCollection();
  93.         $this->projects = new ArrayCollection();
  94.     }
  95.     public function getId(): ?int
  96.     {
  97.         return $this->id;
  98.     }
  99.     public function getName(): ?string
  100.     {
  101.         return $this->name;
  102.     }
  103.     public function setName(string $name): self
  104.     {
  105.         $this->name $name;
  106.         return $this;
  107.     }
  108.     public function getColor(): ?string
  109.     {
  110.         return $this->color;
  111.     }
  112.     public function setColor(string $color): self
  113.     {
  114.         $this->color $color;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection<int, WorkerCertificates>
  119.      */
  120. //    public function getWorkerCertificates(): Collection
  121. //    {
  122. //        return $this->workerCertificates;
  123. //    }
  124.     public function addWorkerCertificate(WorkerCertificates $workerCertificate): self
  125.     {
  126.         if (!$this->workerCertificates->contains($workerCertificate)) {
  127.             $this->workerCertificates[] = $workerCertificate;
  128.             $workerCertificate->setCertificate($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeWorkerCertificate(WorkerCertificates $workerCertificate): self
  133.     {
  134.         if ($this->workerCertificates->removeElement($workerCertificate)) {
  135.             // set the owning side to null (unless already changed)
  136.             if ($workerCertificate->getCertificate() === $this) {
  137.                 $workerCertificate->setCertificate(null);
  138.             }
  139.         }
  140.         return $this;
  141.     }
  142. //    public function getGroups(): ?CertificatesGroups
  143. //    {
  144. //        return $this->groups;
  145. //    }
  146.     public function setGroups(?CertificatesGroups $groups): self
  147.     {
  148.         $this->groups $groups;
  149.         return $this;
  150.     }
  151.     /**
  152.      * @return Collection<int, CustomerCertificates>
  153.      */
  154. //    public function getCustomerCertificates(): Collection
  155. //    {
  156. //        return $this->customerCertificates;
  157. //    }
  158.     public function addCustomerCertificate(CustomerCertificates $customerCertificate): self
  159.     {
  160.         if (!$this->customerCertificates->contains($customerCertificate)) {
  161.             $this->customerCertificates[] = $customerCertificate;
  162.             $customerCertificate->setCertificate($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeCustomerCertificate(CustomerCertificates $customerCertificate): self
  167.     {
  168.         if ($this->customerCertificates->removeElement($customerCertificate)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($customerCertificate->getCertificate() === $this) {
  171.                 $customerCertificate->setCertificate(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176.     /**
  177.      * @return Collection<int, ProjectStakeholders>
  178.      */
  179. //    public function getProjectStakeholders(): Collection
  180. //    {
  181. //        return $this->projectStakeholders;
  182. //    }
  183.     public function addProjectStakeholder(ProjectStakeholders $projectStakeholder): self
  184.     {
  185.         if (!$this->projectStakeholders->contains($projectStakeholder)) {
  186.             $this->projectStakeholders[] = $projectStakeholder;
  187.             $projectStakeholder->addDependentCertificate($this);
  188.         }
  189.         return $this;
  190.     }
  191.     public function removeProjectStakeholder(ProjectStakeholders $projectStakeholder): self
  192.     {
  193.         if ($this->projectStakeholders->removeElement($projectStakeholder)) {
  194.             $projectStakeholder->removeDependentCertificate($this);
  195.         }
  196.         return $this;
  197.     }
  198.     /**
  199.      * @return Collection<int, Projects>
  200.      */
  201. //    public function getProjects(): Collection
  202. //    {
  203. //        return $this->projects;
  204. //    }
  205.     public function addProject(Projects $project): self
  206.     {
  207.         if (!$this->projects->contains($project)) {
  208.             $this->projects[] = $project;
  209.             $project->addDependentCertificate($this);
  210.         }
  211.         return $this;
  212.     }
  213.     public function removeProject(Projects $project): self
  214.     {
  215.         if ($this->projects->removeElement($project)) {
  216.             $project->removeDependentCertificate($this);
  217.         }
  218.         return $this;
  219.     }
  220.     public function getCertificateEligibility(): ?CertificateEligibilities
  221.     {
  222.         return $this->certificate_eligibility;
  223.     }
  224.     public function setCertificateEligibility(?CertificateEligibilities $certificate_eligibility): self
  225.     {
  226.         $this->certificate_eligibility $certificate_eligibility;
  227.         return $this;
  228.     }
  229. }