user = $user; return; } $this->user = new User(); $this->user->setSource($this->sourceRepository->findOneBySlug(SystemSlugType::GUEST_USER)); } /** * @param EntityManagerInterface $entityManager * @param UserInterface $user */ public function __construct(SourceRepository $sourceRepository, ?UserInterface $user) { $this->sourceRepository = $sourceRepository; $this->setUser($user); } /** * {@inheritdoc} * * @see \App\Domain\UserManagement\UserSourceDirectorInterface::getUser() */ public function getUser(): UserInterface { return $this->user; } }