122 lines
2.9 KiB
PHP
122 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Entity\Traits\BlameableEntity;
|
|
use App\Entity\Traits\SoftDeletableEntity;
|
|
use App\Entity\Traits\TimestampableEntity;
|
|
use App\Repository\JobProfileRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\DBAL\Types\Types;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Uid\Uuid;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
#[ORM\Entity(repositoryClass: JobProfileRepository::class)]
|
|
class JobProfile implements BlameableEntityInterface, TimestampableEntityInterface, SoftDeletableEntityInterface
|
|
{
|
|
use BlameableEntity;
|
|
use TimestampableEntity;
|
|
use SoftDeletableEntity;
|
|
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(type: 'string', length: 36, unique: true)]
|
|
private string $uuid;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
#[Assert\NotBlank(message: 'Bitte gib die Bezeichnung an')]
|
|
private ?string $name = null;
|
|
|
|
#[ORM\Column(type: Types::JSON)]
|
|
private array $requiredLicenses = [];
|
|
|
|
#[ORM\ManyToMany(targetEntity: Training::class)]
|
|
private Collection $requiredTrainings;
|
|
|
|
#[ORM\ManyToOne]
|
|
#[ORM\JoinColumn(onDelete: 'SET NULL')]
|
|
#[Assert\NotNull(message: 'Bitte ordne eine Feedback-Vorlage zu')]
|
|
private ?FeedbackSet $feedbackSet = null;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->uuid = Uuid::v4();
|
|
$this->requiredTrainings = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getUuid(): string
|
|
{
|
|
return $this->uuid;
|
|
}
|
|
|
|
public function getName(): ?string
|
|
{
|
|
return $this->name;
|
|
}
|
|
|
|
public function setName(string $name): static
|
|
{
|
|
$this->name = $name;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getRequiredLicenses(): array
|
|
{
|
|
return $this->requiredLicenses;
|
|
}
|
|
|
|
public function setRequiredLicenses(array $requiredLicenses): static
|
|
{
|
|
$this->requiredLicenses = $requiredLicenses;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Training>
|
|
*/
|
|
public function getRequiredTrainings(): Collection
|
|
{
|
|
return $this->requiredTrainings;
|
|
}
|
|
|
|
public function addRequiredTraining(Training $requiredTraining): static
|
|
{
|
|
if (!$this->requiredTrainings->contains($requiredTraining)) {
|
|
$this->requiredTrainings->add($requiredTraining);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeRequiredTraining(Training $requiredTraining): static
|
|
{
|
|
$this->requiredTrainings->removeElement($requiredTraining);
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getFeedbackSet(): ?FeedbackSet
|
|
{
|
|
return $this->feedbackSet;
|
|
}
|
|
|
|
public function setFeedbackSet(?FeedbackSet $feedbackSet): static
|
|
{
|
|
$this->feedbackSet = $feedbackSet;
|
|
|
|
return $this;
|
|
}
|
|
}
|