Skip to content

Commit

Permalink
Added dochead for grabFromDatabase (Codeception#4945)
Browse files Browse the repository at this point in the history
Added dochead for proceedSeeInDatabase
  • Loading branch information
rwese authored and DavertMik committed Apr 30, 2018
1 parent df7f10a commit 604e62c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Codeception/Module/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 534,16 @@ protected function countInDatabase($table, array $criteria = [])
return (int) $this->proceedSeeInDatabase($table, 'count(*)', $criteria);
}

/**
* Fetches all values from the column in database.
* Provide table name, desired column and criteria.
*
* @param string $table
* @param string $column
* @param array $criteria
*
* @return array
*/
protected function proceedSeeInDatabase($table, $column, $criteria)
{
$query = $this->driver->select($column, $table, $criteria);
Expand Down Expand Up @@ -573,6 583,21 @@ public function grabColumnFromDatabase($table, $column, array $criteria = [])
return $sth->fetchAll(\PDO::FETCH_COLUMN, 0);
}

/**
* Fetches all values from the column in database.
* Provide table name, desired column and criteria.
*
* ``` php
* <?php
* $mails = $I->grabFromDatabase('users', 'email', array('name' => 'RebOOter'));
* ```
*
* @param string $table
* @param string $column
* @param array $criteria
*
* @return array
*/
public function grabFromDatabase($table, $column, $criteria = [])
{
return $this->proceedSeeInDatabase($table, $column, $criteria);
Expand Down

0 comments on commit 604e62c

Please sign in to comment.