<?phpnamespace App\Entity;use App\Repository\SectoralRepository;use DateTimeImmutable;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: SectoralRepository::class)]class Sectoral{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $label = null; #[ORM\Column(length: 15)] private ?string $code = null; #[ORM\OneToMany(mappedBy: 'sectoral', targetEntity: User::class)] private Collection $user; #[ORM\ManyToOne] private ?User $createdBy = null; #[ORM\ManyToOne] private ?User $updatedBy = null; #[ORM\Column] private ?DateTimeImmutable $createdAt = null; #[ORM\Column(nullable: true)] private ?DateTimeImmutable $updatedAt = null; public function __construct() { $this->user = new ArrayCollection(); $this->createdAt = new DateTimeImmutable(); $this->updatedAt = new DateTimeImmutable(); } public function getId(): ?int { return $this->id; } public function getLabel(): ?string { return $this->label; } public function setLabel(string $label): self { $this->label = $label; return $this; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } /** * @return Collection<int, User> */ public function getUser(): Collection { return $this->user; } public function addUser(User $user): self { if (!$this->user->contains($user)) { $this->user->add($user); $user->setSectoral($this); } return $this; } public function removeUser(User $user): self { if ($this->user->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getSectoral() === $this) { $user->setSectoral(null); } } return $this; } public function getCreatedBy(): ?User { return $this->createdBy; } public function setCreatedBy(?User $createdBy): self { $this->createdBy = $createdBy; return $this; } public function getUpdatedBy(): ?User { return $this->updatedBy; } public function setUpdatedBy(?User $updatedBy): self { $this->updatedBy = $updatedBy; return $this; } public function getCreatedAt(): ?DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(DateTimeImmutable $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(?DateTimeImmutable $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } public function __toString(): string { return $this->label; }}