*/ #[ORM\OneToMany(targetEntity: Post::class, mappedBy: 'profil')] private Collection $posts; /** * @var Collection */ #[ORM\OneToMany(targetEntity: Commentary::class, mappedBy: 'profil')] private Collection $commentaries; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: self::class, inversedBy: 'followers')] private Collection $followers; public function __construct() { $this->posts = new ArrayCollection(); $this->commentaries = new ArrayCollection(); $this->followers = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function setId(int $id): ?int { return $this->id = $id; } public function getName(): ?string { return $this->name; } public function setName(?string $name): static { $this->name = $name; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getPassword(): ?string { return $this->password; } public function setPassword(?string $password): static { $this->password = $password; return $this; } /** * @return Collection */ public function getPosts(): Collection { return $this->posts; } public function addPost(Post $post): static { if (!$this->posts->contains($post)) { $this->posts->add($post); $post->setProfil($this); } return $this; } public function removePost(Post $post): static { if ($this->posts->removeElement($post)) { // set the owning side to null (unless already changed) if ($post->getProfil() === $this) { $post->setProfil(null); } } return $this; } /** * @return Collection */ public function getCommentaries(): Collection { return $this->commentaries; } public function addCommentary(Commentary $commentary): static { if (!$this->commentaries->contains($commentary)) { $this->commentaries->add($commentary); $commentary->setProfil($this); } return $this; } public function removeCommentary(Commentary $commentary): static { if ($this->commentaries->removeElement($commentary)) { // set the owning side to null (unless already changed) if ($commentary->getProfil() === $this) { $commentary->setProfil(null); } } return $this; } /** * @return Collection */ public function getFollowers(): Collection { return $this->followers; } public function addFollower(self $follower): static { if (!$this->followers->contains($follower)) { $this->followers->add($follower); } return $this; } public function removeFollower(self $follower): static { $this->followers->removeElement($follower); return $this; } public function getRoles(): array { $roles = $this->roles; // guarantee every user at least has ROLE_USER // $roles[] = 'ROLE_USER'; return array_unique($roles); } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function getUserIdentifier(): string { return $this->name; } public function eraseCredentials(): void { // TODO: Implement eraseCredentials() method. } }