/** * Removes ownership of all workspaces currently owned by the given user * * @param User $user The user currently owning workspaces * @return void */ protected function removeOwnerFromUsersWorkspaces(User $user) { /** @var Workspace $workspace */ foreach ($this->workspaceRepository->findByOwner($user) as $workspace) { $workspace->setOwner(null); $this->workspaceRepository->update($workspace); } }