Doctrine\DBAL\Connection::fetchArray PHP Method

fetchArray() public method

Prepares and executes an SQL query and returns the first row of the result as a numerically indexed array.
public fetchArray ( string $statement, array $params = [], array $types = [] ) : array | boolean
$statement string The SQL query to be executed.
$params array The prepared statement params.
$types array The query parameter types.
return array | boolean False is returned if no rows are found.
    public function fetchArray($statement, array $params = array(), array $types = array())
    {
        return $this->executeQuery($statement, $params, $types)->fetch(PDO::FETCH_NUM);
    }

Usage Example

コード例 #1
0
 /**
  * @param Contract $streamContract
  * @param Identifier $streamId
  * @param $expectedStreamRevision
  * @throws \EventCentric\Persistence\OptimisticConcurrencyFailed
  */
 protected function controlOptimisticConcurrency(Contract $streamContract, Identifier $streamId, $expectedStreamRevision)
 {
     $result = $this->connection->fetchArray(MaxStreamRevision::from(self::TABLE_NAME), ['streamContract' => $streamContract, 'streamId' => $streamId]);
     $actualStreamRevision = (int) $result[0];
     if ($actualStreamRevision != $expectedStreamRevision) {
         throw OptimisticConcurrencyFailed::revisionDoesNotMatch($expectedStreamRevision, $actualStreamRevision);
     }
 }
All Usage Examples Of Doctrine\DBAL\Connection::fetchArray