Skip to content

Commit

Permalink
Introduce fetch* methods in query builder
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-demb committed Jan 27, 2021
1 parent b4d5a62 commit f8e060e
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions lib/Doctrine/DBAL/Query/QueryBuilder.php
Expand Up @@ -197,6 +197,86 @@ public function getState()
return $this->state;
}

/**
* @return array<string, mixed>|false False is returned if no rows are found.
*
* @throws Exception
*/
public function fetchAssociative()
{
return $this->connection->fetchAssociative($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return array<int, mixed>|false False is returned if no rows are found.
*
* @throws Exception
*/
public function fetchNumeric()
{
return $this->connection->fetchNumeric($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return mixed|false False is returned if no rows are found.
*
* @throws Exception
*/
public function fetchOne()
{
return $this->connection->fetchOne($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return array<int,array<int,mixed>>
*
* @throws Exception
*/
public function fetchAllNumeric(): array
{
return $this->connection->fetchAllNumeric($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return array<int,array<string,mixed>>
*
* @throws Exception
*/
public function fetchAllAssociative(): array
{
return $this->connection->fetchAllAssociative($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return array<mixed,mixed>
*
* @throws Exception
*/
public function fetchAllKeyValue(): array
{
return $this->connection->fetchAllKeyValue($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return array<mixed,array<string,mixed>>
*
* @throws Exception
*/
public function fetchAllAssociativeIndexed(): array
{
return $this->connection->fetchAllAssociativeIndexed($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* @return array<int,mixed>
*
* @throws Exception
*/
public function fetchFirstColumn(): array
{
return $this->connection->fetchFirstColumn($this->getSQL(), $this->params, $this->paramTypes);
}

/**
* Executes this query using the bound parameters and their types.
*
Expand Down

0 comments on commit f8e060e

Please sign in to comment.