<?phpnamespace App\Core\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\Core\Repository\ColorRepository") */class Color{ /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=15) */ private $nombre; /** * @ORM\Column(type="string", length=7) */ private $codigo; /** * @ORM\OneToMany(targetEntity="App\Core\Entity\Curso", mappedBy="color") */ private $cursos; public function __construct() { $this->cursos = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNombre(): ?string { return $this->nombre; } public function setNombre(string $nombre): self { $this->nombre = $nombre; return $this; } public function getCodigo(): ?string { return $this->codigo; } public function setCodigo(string $codigo): self { $this->codigo = $codigo; return $this; } /** * @return Collection|Curso[] */ public function getCursos(): Collection { return $this->cursos; } public function addCurso(Curso $curso): self { if (!$this->cursos->contains($curso)) { $this->cursos[] = $curso; $curso->setColor($this); } return $this; } public function removeCurso(Curso $curso): self { if ($this->cursos->contains($curso)) { $this->cursos->removeElement($curso); // set the owning side to null (unless already changed) if ($curso->getColor() === $this) { $curso->setColor(null); } } return $this; }}