Created
March 8, 2019 13:56
-
-
Save woprrr/5140615371b86560e87064e37578de49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Populate organisation with given already existing user list. | |
* | |
* @param array $userList | |
* | |
* @return \Doctrine\Common\Collections\ArrayCollection | |
*/ | |
private function populateUsers(array $userList): ArrayCollection | |
{ | |
$collection = new ArrayCollection(); | |
foreach ($userList as $userId) { | |
if ($collection->contains($userId)) { | |
continue; | |
} | |
$user = $this->userRepository->find($userId); | |
if ($user) { | |
$collection[] = $user; | |
} | |
} | |
return $collection; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment