anonymous_user = null; } /** * Returns the anonymous user. * The result is cached, so the database is only called once, after the anonymous user was found. * * @return User|null */ public function getAnonymousUser() { if ($this->anonymous_user === null) { $this->anonymous_user = $this->findOneBy([ 'id' => User::ID_ANONYMOUS, ]); } return $this->anonymous_user; } }