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

getParameterType() public method

Gets a (previously set) query parameter type of the query being constructed.
public getParameterType ( mixed $key ) : mixed
$key mixed The key (index or name) of the bound parameter type.
return mixed The value of the bound parameter type.
    public function getParameterType($key)
    {
        return isset($this->paramTypes[$key]) ? $this->paramTypes[$key] : null;
    }

Usage Example

 /**
  * @group DBAL-959
  */
 public function testGetParameterType()
 {
     $qb = new QueryBuilder($this->conn);
     $qb->select('*')->from('users');
     $this->assertNull($qb->getParameterType('name'));
     $qb->where('name = :name');
     $qb->setParameter('name', 'foo');
     $this->assertNull($qb->getParameterType('name'));
     $qb->setParameter('name', 'foo', \PDO::PARAM_STR);
     $this->assertSame(\PDO::PARAM_STR, $qb->getParameterType('name'));
 }
All Usage Examples Of Doctrine\DBAL\Query\QueryBuilder::getParameterType