Doctrine\DBAL\Query\QueryBuilder::execute PHP Method

execute() public method

Uses {@see \Connection::executeQuery} for select statements and {@see \Connection::executeUpdate} for insert, update and delete statements.
public execute ( ) : Doctrine\DBAL\Driver\Statement | integer
return Doctrine\DBAL\Driver\Statement | integer
    public function execute()
    {
        if ($this->type == self::SELECT) {
            return $this->connection->executeQuery($this->getSQL(), $this->params, $this->paramTypes);
        } else {
            return $this->connection->executeUpdate($this->getSQL(), $this->params, $this->paramTypes);
        }
    }

Usage Example

Esempio n. 1
0
 /**
  * @return array
  */
 public function fetch()
 {
     $data = $this->query->execute()->fetchAll(\PDO::FETCH_KEY_PAIR);
     $keys = array_keys($data);
     $this->query->setParameter(':lastId', array_pop($keys));
     return array_values($data);
 }
All Usage Examples Of Doctrine\DBAL\Query\QueryBuilder::execute