Skip to content

Commit f031a9f

Browse files
MitrichiusNaktibalda
authored andcommitted
fix grabFromDatabase description in docs (#5717)
1 parent 734a4ea commit f031a9f

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Codeception/Module/Db.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -883,19 +883,28 @@ public function grabColumnFromDatabase($table, $column, array $criteria = [])
883883
}
884884

885885
/**
886-
* Fetches all values from the column in database.
886+
* Fetches a single column value from a database.
887887
* Provide table name, desired column and criteria.
888888
*
889889
* ``` php
890890
* <?php
891-
* $mails = $I->grabFromDatabase('users', 'email', array('name' => 'RebOOter'));
891+
* $mail = $I->grabFromDatabase('users', 'email', array('name' => 'Davert'));
892+
* ```
893+
* Comparison expressions can be used as well:
894+
*
895+
* ```php
896+
* <?php
897+
* $post = $I->grabFromDatabase('posts', ['num_comments >=' => 100]);
898+
* $user = $I->grabFromDatabase('users', ['email like' => 'miles%']);
892899
* ```
893900
*
901+
* Supported operators: `<`, `>`, `>=`, `<=`, `!=`, `like`.
902+
*
894903
* @param string $table
895904
* @param string $column
896-
* @param array $criteria
905+
* @param array $criteria
897906
*
898-
* @return mixed
907+
* @return mixed Returns a single column value or false
899908
*/
900909
public function grabFromDatabase($table, $column, $criteria = [])
901910
{

0 commit comments

Comments
 (0)