<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
class CategoriaRecurso extends \App\Entity\BaseEntity
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $nombre;
/**
* @ORM\OneToMany(targetEntity=\App\Entity\Recurso::class, mappedBy="categoriaRecurso")
*/
private $recursos;
public function __construct()
{
$this->recursos = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function setId($id)
{
$this->id = $id;
return $this;
}
public function getNombre(): ?string
{
return $this->nombre;
}
public function setNombre(?string $nombre): static
{
$this->nombre = $nombre;
return $this;
}
/**
* @return Collection<int, Recurso>
*/
public function getRecursos(): Collection
{
return $this->recursos;
}
public function addRecurso(Recurso $recurso): static
{
if (!$this->recursos->contains($recurso)) {
$this->recursos->add($recurso);
$recurso->setCategoriaRecurso($this);
}
return $this;
}
public function removeRecurso(Recurso $recurso): static
{
if ($this->recursos->removeElement($recurso)) {
// set the owning side to null (unless already changed)
if ($recurso->getCategoriaRecurso() === $this) {
$recurso->setCategoriaRecurso(null);
}
}
return $this;
}
}