The user roles */ #[ORM\Column] private array $roles = []; #[ORM\Column] private ?int $osmId = null; /** * @var Collection */ #[ORM\OneToMany(targetEntity: Project::class, mappedBy: 'createdBy', orphanRemoval: true)] private Collection $projects; /** * @var Collection */ #[ORM\OneToMany(targetEntity: Task::class, mappedBy: 'createdBy', orphanRemoval: true)] private Collection $tasks; public function __construct() { $this->projects = new ArrayCollection(); $this->tasks = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getUsername(): ?string { return $this->username; } public function setUsername(string $username): static { $this->username = $username; return $this; } /** * A visual identifier that represents this user. * * @see UserInterface */ public function getUserIdentifier(): string { return (string) $this->username; } /** * @see UserInterface * * @return list */ public function getRoles(): array { $roles = $this->roles; // guarantee every user at least has ROLE_USER $roles[] = 'ROLE_USER'; return array_unique($roles); } /** * @param list $roles */ public function setRoles(array $roles): static { $this->roles = $roles; return $this; } /** * @see UserInterface */ public function eraseCredentials(): void { // If you store any temporary, sensitive data on the user, clear it here // $this->plainPassword = null; } public function getOsmId(): ?int { return $this->osmId; } public function setOsmId(int $osmId): static { $this->osmId = $osmId; return $this; } /** * @return Collection */ public function getProjects(): Collection { return $this->projects; } public function addProject(Project $project): static { if (!$this->projects->contains($project)) { $this->projects->add($project); $project->setCreatedBy($this); } return $this; } public function removeProject(Project $project): static { if ($this->projects->removeElement($project)) { // set the owning side to null (unless already changed) if ($project->getCreatedBy() === $this) { $project->setCreatedBy(null); } } return $this; } /** * @return Collection */ public function getTasks(): Collection { return $this->tasks; } public function addTask(Task $task): static { if (!$this->tasks->contains($task)) { $this->tasks->add($task); $task->setCreatedBy($this); } return $this; } public function removeTask(Task $task): static { if ($this->tasks->removeElement($task)) { // set the owning side to null (unless already changed) if ($task->getCreatedBy() === $this) { $task->setCreatedBy(null); } } return $this; } }