Skip to content

Commit

Permalink
Use better example for data retrieval
Browse files Browse the repository at this point in the history
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
xelan authored and derrabus committed Jun 16, 2021
1 parent 3559930 commit 590a30b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/en/reference/data-retrieval-and-manipulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ Prepare a given SQL statement and return the
array(
0 => array(
'username' => 'jwage',
'password' => 'changeme'
'email' => '[email protected]'
)
)
*/
Expand Down Expand Up @@ -353,7 +353,7 @@ parameters to the execute method, then returning the statement:
/*
array(
0 => 'jwage',
1 => 'changeme'
1 => '[email protected]'
)
*/
Expand All @@ -376,7 +376,7 @@ Execute the query and fetch all results into an array:
array(
0 => array(
'username' => 'jwage',
'password' => 'changeme'
'email' => '[email protected]'
)
)
*/
Expand All @@ -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]',
)
*/
Expand All @@ -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]'
)
)
*/
Expand All @@ -433,7 +433,7 @@ Numeric index retrieval of first result row of the given query:
/*
array(
0 => 'jwage',
1 => 'changeme'
1 => '[email protected]'
)
*/
Expand All @@ -460,7 +460,7 @@ Retrieve associative array of the first result row.
/*
array(
'username' => 'jwage',
'password' => 'changeme'
'email' => '[email protected]'
)
*/
Expand All @@ -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) {
// ...
}
Expand All @@ -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) {
// ...
}
Expand Down

0 comments on commit 590a30b

Please sign in to comment.