<?phpnamespace App\Entity;use App\Repository\PosteRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;#[ORM\Entity(repositoryClass: PosteRepository::class)]class Poste{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 255, nullable: true)] private $code; #[ORM\Column(type: 'string', length: 255)] private $nom; #[ORM\OneToMany(mappedBy: 'poste', targetEntity: User::class)] private $users; #[Gedmo\Timestampable(on: 'create')] #[ORM\Column(type: 'datetime')] private $created_at; #[Gedmo\Timestampable(on: 'update')] #[ORM\Column(type: 'datetime')] private $updated_at; #[ORM\Column(type: 'integer')] private $created_by; #[ORM\Column(type: 'integer')] private $updated_by; #[ORM\Column(length: 255)] private ?string $role = 'ROLE_USER'; #[ORM\ManyToMany(targetEntity: Document::class, mappedBy: 'visibilite')] private Collection $documents; public function __construct() { $this->users = new ArrayCollection(); $this->documents = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCode(): ?string { return $this->code; } public function setCode(?string $code): self { $this->code = $code; return $this; } public function getNom(): ?string { return $this->nom; } public function setNom(string $nom): self { $this->nom = $nom; return $this; } /** * @return Collection<int, User> */ public function getUsers(): Collection { return $this->users; } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; $user->setPoste($this); } return $this; } public function removeUser(User $user): self { if ($this->users->removeElement($user)) { // set the owning side to null (unless already changed) if ($user->getPoste() === $this) { $user->setPoste(null); } } return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->created_at; } public function setCreatedAt(\DateTimeInterface $created_at): self { $this->created_at = $created_at; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updated_at; } public function setUpdatedAt(\DateTimeInterface $updated_at): self { $this->updated_at = $updated_at; return $this; } public function getCreatedBy(): ?int { return $this->created_by; } public function setCreatedBy(int $created_by): self { $this->created_by = $created_by; return $this; } public function getUpdatedBy(): ?int { return $this->updated_by; } public function setUpdatedBy(int $updated_by): self { $this->updated_by = $updated_by; return $this; } public function getRole(): ?string { return $this->role; } public function setRole(string $role): self { $this->role = $role; return $this; } /** * @return Collection<int, Document> */ public function getDocuments(): Collection { return $this->documents; } public function addDocument(Document $document): self { if (!$this->documents->contains($document)) { $this->documents->add($document); $document->addVisibilite($this); } return $this; } public function removeDocument(Document $document): self { if ($this->documents->removeElement($document)) { $document->removeVisibilite($this); } return $this; }}