Skip to content

Instantly share code, notes, and snippets.

@kolyadin
Created January 12, 2015 10:17
Show Gist options
  • Save kolyadin/e744831b0238e0a40874 to your computer and use it in GitHub Desktop.
Save kolyadin/e744831b0238e0a40874 to your computer and use it in GitHub Desktop.
$user = (new User())
->setId($table['id'])
->setEnabled(true)
->setEmail($table['email'])
->setPlainPassword($table['pass'])
->addGroup($em->getRepository('UserBundle:Group')->findOneBy(['name' => 'user']))
->setNick($table['nick'])
->setUsername($table['nick'])
->setAvatar(null)
->setRating((int)$table['rating'])
->setLastLogin(null)
->setCreatedAt(new \DateTime())
->setUserInfo(
(new UserInfo())
->setName($table['name'])
->setSex($this->convertUserSex((int)$table['sex']))
->setCredo($table['credo'])
->setBirthDate($this->convertUserBirthdate($table['birthday']))
->setCountry($em->getReference('GeoBundle:Country', (int)$table['country_id']))
->setCity($em->getReference('GeoBundle:City', (int)$table['city_id']))
->setMarried($this->convertMarried((int)$table['family']))
->setMeetPerson($em->getReference('PersonBundle:Person', (int)$table['meet_actor']))
->setPoints((int)$table['points'])
->setActivist($table['activist_now'] == 1)
->setActivistCount((int)$table['activist'])
)
->setUserSettings(
(new UserSettings())
->setShowBirthDate($table['show_bd'] == 1)
->setDailySubscribe($table['daily_sub'] == 1)
->setAlertMessage($table['alert_on_new_mail'] == 1)
->setAlertGuestBook($table['alert_on_new_guest_items'] == 1)
->setCanInvite($table['can_invite_to_community_groups'] == 1)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment