src/Entity/Gos/CertificatePath.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Entity\Gos\Uniqskills\Certificate;
  4. use App\Entity\Gos\Uniqskills\Test;
  5. use App\Repository\Gos\CertificatePathRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=CertificatePathRepository::class)
  11.  * @ORM\HasLifecycleCallbacks()
  12.  */
  13. class CertificatePath
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\ManyToOne(targetEntity=Test::class, inversedBy="certificatePaths")
  27.      */
  28.     private $test;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=Certificate::class, inversedBy="certificatePaths")
  31.      */
  32.     private $certificate;
  33.     /**
  34.      * @ORM\OneToMany(targetEntity=UserCertificatePath::class, mappedBy="certificatePath", cascade={"persist", "remove"})
  35.      */
  36.     private $userCertificatePaths;
  37.     /**
  38.      * @ORM\Column(type="datetime")
  39.      */
  40.     private $createdAt;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $updatedAt;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=CertificatePathElement::class, mappedBy="certificatePath", cascade={"persist", "remove"})
  47.      */
  48.     private $certificatePathElements;
  49.     public function __toString()
  50.     {
  51.         return (string)$this->name;
  52.     }
  53.     public function __construct()
  54.     {
  55.         $this->certificatePathElements = new ArrayCollection();
  56.         $this->userCertificatePaths = new ArrayCollection();
  57.     }
  58.     /** @ORM\PrePersist() */
  59.     public function prePersist()
  60.     {
  61.         $this->createdAt = new \DateTime();
  62.     }
  63.     /** @ORM\PreUpdate() */
  64.     public function preUpdate()
  65.     {
  66.         $this->updatedAt = new \DateTime();
  67.     }
  68.     public function getId(): ?int
  69.     {
  70.         return $this->id;
  71.     }
  72.     public function getName(): ?string
  73.     {
  74.         return $this->name;
  75.     }
  76.     public function setName(string $name): self
  77.     {
  78.         $this->name $name;
  79.         return $this;
  80.     }
  81.     public function getTest(): ?Test
  82.     {
  83.         return $this->test;
  84.     }
  85.     public function setTest(?Test $test): self
  86.     {
  87.         $this->test $test;
  88.         return $this;
  89.     }
  90.     public function getCertificate(): ?Certificate
  91.     {
  92.         return $this->certificate;
  93.     }
  94.     public function setCertificate(?Certificate $certificate): self
  95.     {
  96.         $this->certificate $certificate;
  97.         return $this;
  98.     }
  99.     public function getCreatedAt(): ?\DateTimeInterface
  100.     {
  101.         return $this->createdAt;
  102.     }
  103.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  104.     {
  105.         $this->createdAt $createdAt;
  106.         return $this;
  107.     }
  108.     public function getUpdatedAt(): ?\DateTimeInterface
  109.     {
  110.         return $this->updatedAt;
  111.     }
  112.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  113.     {
  114.         $this->updatedAt $updatedAt;
  115.         return $this;
  116.     }
  117.     /**
  118.      * @return Collection|CertificatePathElement[]
  119.      */
  120.     public function getCertificatePathElements(): Collection
  121.     {
  122.         return $this->certificatePathElements;
  123.     }
  124.     public function addCertificatePathElement(CertificatePathElement $certificatePathElement): self
  125.     {
  126.         if (!$this->certificatePathElements->contains($certificatePathElement)) {
  127.             $this->certificatePathElements[] = $certificatePathElement;
  128.             $certificatePathElement->setCertificatePath($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeCertificatePathElement(CertificatePathElement $certificatePathElement): self
  133.     {
  134.         if ($this->certificatePathElements->contains($certificatePathElement)) {
  135.             $this->certificatePathElements->removeElement($certificatePathElement);
  136.             // set the owning side to null (unless already changed)
  137.             if ($certificatePathElement->getCertificatePath() === $this) {
  138.                 $certificatePathElement->setCertificatePath(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     /**
  144.      * @return Collection|userCertificatePaths[]
  145.      */
  146.     public function getUserCertificatePaths(): Collection
  147.     {
  148.         return $this->userCertificatePaths;
  149.     }
  150.     public function addUserCertificatePaths(UserCertificatePath $userCertificatePath): self
  151.     {
  152.         if (!$this->userCertificatePaths->contains($userCertificatePath)) {
  153.             $this->userCertificatePaths[] = $userCertificatePath;
  154.             $userCertificatePath->setCertificatePath($this);
  155.         }
  156.         return $this;
  157.     }
  158.     public function removeUserCertificatePaths(UserCertificatePath $userCertificatePath): self
  159.     {
  160.         if ($this->userCertificatePaths->contains($userCertificatePath)) {
  161.             $this->userCertificatePaths->removeElement($userCertificatePath);
  162.             // set the owning side to null (unless already changed)
  163.             if ($userCertificatePath->getCertificatePath() === $this) {
  164.                 $userCertificatePath->setCertificatePath(null);
  165.             }
  166.         }
  167.         return $this;
  168.     }
  169. }