public function loadFOSUser() { foreach ($this->loadRaw('User') as $key => $data) { $entity = new User(); $entity->setEnabled(true); $entity->setFirstName($data['firstName']); $entity->setLastName($data['lastName']); $entity->setUsername($data['username']); $entity->setEmail($data['email']); $entity->setPlainPassword($data['plainPassword']); foreach ($data['roles'] as $role) { $entity->addRole($role); } $entity->setDateOfBirth(new \DateTime($data['dateOfBirth'])); $this->addReference($key, $entity); $this->manager->persist($entity); } }