<?php
namespace App\Entity\Gos;
use App\Entity\Gos\Uniqskills\Certificate;
use App\Entity\Gos\Uniqskills\Test;
use App\Repository\Gos\CertificatePathRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CertificatePathRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class CertificatePath
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToOne(targetEntity=Test::class, inversedBy="certificatePaths")
*/
private $test;
/**
* @ORM\ManyToOne(targetEntity=Certificate::class, inversedBy="certificatePaths")
*/
private $certificate;
/**
* @ORM\OneToMany(targetEntity=UserCertificatePath::class, mappedBy="certificatePath", cascade={"persist", "remove"})
*/
private $userCertificatePaths;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\OneToMany(targetEntity=CertificatePathElement::class, mappedBy="certificatePath", cascade={"persist", "remove"})
*/
private $certificatePathElements;
public function __toString()
{
return (string)$this->name;
}
public function __construct()
{
$this->certificatePathElements = new ArrayCollection();
$this->userCertificatePaths = new ArrayCollection();
}
/** @ORM\PrePersist() */
public function prePersist()
{
$this->createdAt = new \DateTime();
}
/** @ORM\PreUpdate() */
public function preUpdate()
{
$this->updatedAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getTest(): ?Test
{
return $this->test;
}
public function setTest(?Test $test): self
{
$this->test = $test;
return $this;
}
public function getCertificate(): ?Certificate
{
return $this->certificate;
}
public function setCertificate(?Certificate $certificate): self
{
$this->certificate = $certificate;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @return Collection|CertificatePathElement[]
*/
public function getCertificatePathElements(): Collection
{
return $this->certificatePathElements;
}
public function addCertificatePathElement(CertificatePathElement $certificatePathElement): self
{
if (!$this->certificatePathElements->contains($certificatePathElement)) {
$this->certificatePathElements[] = $certificatePathElement;
$certificatePathElement->setCertificatePath($this);
}
return $this;
}
public function removeCertificatePathElement(CertificatePathElement $certificatePathElement): self
{
if ($this->certificatePathElements->contains($certificatePathElement)) {
$this->certificatePathElements->removeElement($certificatePathElement);
// set the owning side to null (unless already changed)
if ($certificatePathElement->getCertificatePath() === $this) {
$certificatePathElement->setCertificatePath(null);
}
}
return $this;
}
/**
* @return Collection|userCertificatePaths[]
*/
public function getUserCertificatePaths(): Collection
{
return $this->userCertificatePaths;
}
public function addUserCertificatePaths(UserCertificatePath $userCertificatePath): self
{
if (!$this->userCertificatePaths->contains($userCertificatePath)) {
$this->userCertificatePaths[] = $userCertificatePath;
$userCertificatePath->setCertificatePath($this);
}
return $this;
}
public function removeUserCertificatePaths(UserCertificatePath $userCertificatePath): self
{
if ($this->userCertificatePaths->contains($userCertificatePath)) {
$this->userCertificatePaths->removeElement($userCertificatePath);
// set the owning side to null (unless already changed)
if ($userCertificatePath->getCertificatePath() === $this) {
$userCertificatePath->setCertificatePath(null);
}
}
return $this;
}
}