protected function getDatabaseArray(AuthUser $user)
 {
     $databases = [];
     foreach ($user->getDatabases() as $database) {
         $databases[] = array('id' => $database->getName(), 'name' => $database->getDisplayName(), 'parameters' => $this->getParametersArray($database->getParameters()));
     }
     return $databases;
 }
Ejemplo n.º 2
0
 /**
  * Create a new AuthUser
  *
  * @param array $data
  *
  * @return AuthUser
  */
 public function createAuthUser($data)
 {
     $user = new AuthUser();
     $user->setUsername($data['username']);
     if (count($data['databases']) > 0) {
         foreach ($data['databases'] as $databases) {
             if ($databases instanceof Database) {
                 $user->addDatabase($databases);
             }
         }
     }
     $password = $this->encodePassword($user, $data['password']);
     $user->setPassword($password);
     $this->entityManager->persist($user);
     $this->entityManager->flush();
     return $user;
 }