createdAt = new \DateTime(); } // Getter und Setter public function getId(): int { return $this->id; } public function getUsername(): string { return $this->username; } public function setUsername(string $username): self { $this->username = $username; return $this; } public function getEmail(): string { return $this->email; } public function setEmail(string $email): self { $this->email = $email; return $this; } public function getPassword(): string { return $this->password; } public function setPassword(string $password): self { $this->password = $password; return $this; } public function getCreatedAt(): \DateTime { return $this->createdAt; } public function setCreatedAt(\DateTime $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getRolle(): string { return $this->rolle; } public function setRolle(string $rolle): self { if (!in_array($rolle, ['user', 'admin', 'werbenetzwerk'])) { throw new \InvalidArgumentException('Rolle muss "user", "admin" oder "werbenetzwerk" sein'); } $this->rolle = $rolle; return $this; } public function isAdmin(): bool { return $this->rolle === 'admin'; } public function isWerbenetzwerk(): bool { return $this->rolle === 'werbenetzwerk'; } public function getWerbenetzwerk(): ?Werbenetzwerk { return $this->werbenetzwerk; } public function setWerbenetzwerk(?Werbenetzwerk $werbenetzwerk): self { $this->werbenetzwerk = $werbenetzwerk; return $this; } }