/** * @return User */ public function create() { $isMale = rand(0, 1); $this->counter++; $user = new User(); $user->setBirthYear($this->getRandomBirthYear()); $email = $this->getRandomEmail(); $user->setEmail($email); $user->setEmailCanonical($email); $user->setLastName($this->getRandomLastName()); $user->setEnabled(true); $user->setHeadline($this->getRandomHeadline()); $user->setAbout($this->getRandomAbout()); $user->setPlainPassword($this->getRandomPassword()); $user->setScore($this->getRandomScore()); if ($isMale) { $user->setFirstName($this->getRandomMaleFirstName()); $user->setAvatar($this->getRandomMaleAvatar()); } else { $user->setFirstName($this->getRandomFemaleFirstName()); $user->setAvatar($this->getRandomFemaleAvatar()); } $this->entityManager->persist($user); return $user; }