|
|
|
|
@ -6,6 +6,8 @@ declare(strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace Chamilo\CoreBundle\Entity; |
|
|
|
|
|
|
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
use Doctrine\Common\Collections\Collection; |
|
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
|
|
|
|
|
|
|
|
@ -25,6 +27,17 @@ class SkillProfile |
|
|
|
|
#[ORM\Column(name: 'description', type: 'text', nullable: false)] |
|
|
|
|
protected string $description; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @var Collection<int, SkillRelProfile> |
|
|
|
|
*/ |
|
|
|
|
#[ORM\OneToMany(mappedBy: 'profile', targetEntity: SkillRelProfile::class, cascade: ['persist'])] |
|
|
|
|
private Collection $skills; |
|
|
|
|
|
|
|
|
|
public function __construct() |
|
|
|
|
{ |
|
|
|
|
$this->skills = new ArrayCollection(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function setTitle(string $title): self |
|
|
|
|
{ |
|
|
|
|
$this->title = $title; |
|
|
|
|
@ -62,4 +75,34 @@ class SkillProfile |
|
|
|
|
{ |
|
|
|
|
return $this->id; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return Collection<int, SkillRelProfile> |
|
|
|
|
*/ |
|
|
|
|
public function getSkills(): Collection |
|
|
|
|
{ |
|
|
|
|
return $this->skills; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function addSkill(SkillRelProfile $skill): static |
|
|
|
|
{ |
|
|
|
|
if (!$this->skills->contains($skill)) { |
|
|
|
|
$this->skills->add($skill); |
|
|
|
|
$skill->setProfile($this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function removeSkill(SkillRelProfile $skill): static |
|
|
|
|
{ |
|
|
|
|
if ($this->skills->removeElement($skill)) { |
|
|
|
|
// set the owning side to null (unless already changed) |
|
|
|
|
if ($skill->getProfile() === $this) { |
|
|
|
|
$skill->setProfile(null); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|