chore (fetch datas) #39 : fermeture curseur sql après login$ #40
|
@ -13,9 +13,8 @@ class SQLLoginConnect extends AbstractController
|
|||
* Méthode qui crée l'unique instance de la classe
|
||||
* si elle n'existe pas encore puis la retourne.
|
||||
*
|
||||
* @return SQLLoginConnect
|
||||
*/
|
||||
public static function getInstance()
|
||||
public static function getInstance(): SQLLoginConnect
|
||||
{
|
||||
if (is_null(self::$_instance)) {
|
||||
self::$_instance = new SQLLoginConnect();
|
||||
|
@ -24,7 +23,7 @@ class SQLLoginConnect extends AbstractController
|
|||
return self::$_instance;
|
||||
}
|
||||
|
||||
public function connect($urlDatabase, $dbUser, $dbPassword)
|
||||
public function connect($urlDatabase, $dbUser, $dbPassword): PDO
|
||||
{
|
||||
return new PDO($urlDatabase, $dbUser, $dbPassword);
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ class SQLLoginService extends AbstractController
|
|||
$query = $dbh->prepare($request);
|
||||
$query->execute([$this->sqlLoginRequest->getLoginColumnName() => $login]);
|
||||
$password = $query->fetch(PDO::FETCH_ASSOC);
|
||||
$query->closeCursor();
|
||||
} catch (PDOException $e) {
|
||||
$this->loggerInterface->critical($e->getMessage());
|
||||
throw new LoginElementsConfigurationException($e->getMessage());
|
||||
|
@ -82,7 +83,6 @@ class SQLLoginService extends AbstractController
|
|||
if (!$password) {
|
||||
throw new Exception('Une erreur est survenue lors de la récupération des données');
|
||||
}
|
||||
|
||||
return [
|
||||
$password[$this->sqlLoginRequest->getPasswordColumnName()],
|
||||
isset($password[$this->sqlLoginRequest->getSaltColumnName()]) ? $password[$this->sqlLoginRequest->getSaltColumnName()] : null,
|
||||
|
|
Loading…
Reference in New Issue