<?php
namespace App\Entity;
use App\Repository\CompetenceRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CompetenceRepository::class)
*/
class Competence
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=50)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Course::class, mappedBy="competence")
*/
private $course;
public function __construct()
{
$this->course = new ArrayCollection();
}
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;
}
/**
* @return Collection<int, Course>
*/
public function getCourse(): Collection
{
return $this->course;
}
public function addCourse(Course $course): self
{
if (!$this->course->contains($course)) {
$this->course[] = $course;
$course->setCompetence($this);
}
return $this;
}
public function removeCourse(Course $course): self
{
if ($this->course->removeElement($course)) {
// set the owning side to null (unless already changed)
if ($course->getCompetence() === $this) {
$course->setCompetence(null);
}
}
return $this;
}
}