src/Entity/SkillCategory.php line 11
<?php
namespace App\Entity;
use App\Repository\SkillCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: SkillCategoryRepository::class)]
class SkillCategory
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $nom = null;
#[ORM\OneToMany(mappedBy: 'category', targetEntity: Skill::class)]
private Collection $skills;
public function __construct()
{
$this->skills = new ArrayCollection();
}
public function __toString()
{
return $this->nom;
}
public function getId(): ?int
{
return $this->id;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
/**
* @return Collection<int, Skill>
*/
public function getSkills(): Collection
{
return $this->skills;
}
public function addSkill(Skill $skill): self
{
if (!$this->skills->contains($skill)) {
$this->skills->add($skill);
$skill->setCategory($this);
}
return $this;
}
public function removeSkill(Skill $skill): self
{
if ($this->skills->removeElement($skill)) {
// set the owning side to null (unless already changed)
if ($skill->getCategory() === $this) {
$skill->setCategory(null);
}
}
return $this;
}
public function getUrlFormatName(): string
{
return \URLify::slug($this->nom);
}
}