-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use better example for data retrieval
The existing example proposes clear-text storage of passwords, which is highly discouraged. Furthermore, such an example sheds a negative light on the Doctrine project if security-conscious developers evaluate whether they should use the library based on the provided examples.
- Loading branch information
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -316,7 +316,7 @@ Prepare a given SQL statement and return the | |
array( | ||
0 => array( | ||
'username' => 'jwage', | ||
'password' => 'changeme' | ||
'email' => '[email protected]' | ||
) | ||
) | ||
*/ | ||
|
@@ -353,7 +353,7 @@ parameters to the execute method, then returning the statement: | |
/* | ||
array( | ||
0 => 'jwage', | ||
1 => 'changeme' | ||
1 => '[email protected]' | ||
) | ||
*/ | ||
|
@@ -376,7 +376,7 @@ Execute the query and fetch all results into an array: | |
array( | ||
0 => array( | ||
'username' => 'jwage', | ||
'password' => 'changeme' | ||
'email' => '[email protected]' | ||
) | ||
) | ||
*/ | ||
|
@@ -389,11 +389,11 @@ Execute the query and fetch the first two columns into an associative array as k | |
.. code-block:: php | ||
<?php | ||
$users = $conn->fetchAllKeyValue('SELECT username, password FROM user'); | ||
$users = $conn->fetchAllKeyValue('SELECT username, email FROM user'); | ||
/* | ||
array( | ||
'jwage' => 'changeme', | ||
'jwage' => '[email protected]', | ||
) | ||
*/ | ||
|
@@ -409,13 +409,13 @@ an associative array of the rest of the columns and their values: | |
.. code-block:: php | ||
<?php | ||
$users = $conn->fetchAllAssociativeIndexed('SELECT id, username, password FROM user'); | ||
$users = $conn->fetchAllAssociativeIndexed('SELECT id, username, email FROM user'); | ||
/* | ||
array( | ||
1 => array( | ||
'username' => 'jwage', | ||
'password' => 'changeme', | ||
'email' => '[email protected]' | ||
) | ||
) | ||
*/ | ||
|
@@ -433,7 +433,7 @@ Numeric index retrieval of first result row of the given query: | |
/* | ||
array( | ||
0 => 'jwage', | ||
1 => 'changeme' | ||
1 => '[email protected]' | ||
) | ||
*/ | ||
|
@@ -460,7 +460,7 @@ Retrieve associative array of the first result row. | |
/* | ||
array( | ||
'username' => 'jwage', | ||
'password' => 'changeme' | ||
'email' => '[email protected]' | ||
) | ||
*/ | ||
|
@@ -474,7 +474,7 @@ Execute the query and iterate over the first two columns as keys and values resp | |
.. code-block:: php | ||
<?php | ||
foreach ($conn->iterateKeyValue('SELECT username, password FROM user') as $username => $password) { | ||
foreach ($conn->iterateKeyValue('SELECT username, email FROM user') as $username => $email) { | ||
// ... | ||
} | ||
|
@@ -490,7 +490,7 @@ an associative array of the rest of the columns and their values: | |
.. code-block:: php | ||
<?php | ||
foreach ($conn->iterateAssociativeIndexed('SELECT id, username, password FROM user') as $id => $data) { | ||
foreach ($conn->iterateAssociativeIndexed('SELECT id, username, email FROM user') as $id => $data) { | ||
// ... | ||
} | ||
|