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.
 /**
  * @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'));
 }
 /**
  * @test
  */
 public function getParameterTypeDelegatesToConcreteQueryBuilder()
 {
     $this->concreteQueryBuilder->getParameterType(Argument::exact('aField'))->shouldBeCalled()->willReturn(Connection::PARAM_STR);
     $this->subject->getParameterType('aField');
 }
Esempio n. 3
0
 /**
  * Gets a (previously set) query parameter type of the query being constructed.
  *
  * @param mixed $key The key (index or name) of the bound parameter type.
  *
  * @return mixed The value of the bound parameter type.
  */
 public function getParameterType($key)
 {
     return $this->queryBuilder->getParameterType($key);
 }