本文整理匯總了PHP中Doctrine\DBAL\Query\QueryBuilder::add方法的典型用法代碼示例。如果您正苦於以下問題:PHP QueryBuilder::add方法的具體用法?PHP QueryBuilder::add怎麽用?PHP QueryBuilder::add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\DBAL\Query\QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::add方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add
public function add($sqlPartName, $sqlPart, $append = false)
{
if ($sqlPartName == 'select') {
if (is_array($sqlPart)) {
$i = 0;
foreach ($sqlPart as $term) {
$sqlPart[$i] = $this->quoteSelectTerm($term);
$i++;
}
} else {
$sqlPart = $this->quoteSelectTerm($sqlPart);
}
}
return parent::add($sqlPartName, $sqlPart, $append);
}
示例2: addDelegatesToConcreteQueryBuilder
/**
* @test
*/
public function addDelegatesToConcreteQueryBuilder()
{
$this->concreteQueryBuilder->add(Argument::exact('select'), Argument::exact('aField'), Argument::cetera())->shouldBeCalled()->willReturn($this->subject);
$this->subject->add('select', 'aField');
}
示例3: testApplyAnonymous
/**
* @covers Kunstmaan\AdminBundle\Helper\Security\Acl\AclNativeHelper::apply
*/
public function testApplyAnonymous()
{
$queryBuilder = new QueryBuilder($this->conn);
$queryBuilder->add('from', array(array('table' => 'myTable', 'alias' => 'n')));
$roles = array();
$this->token->expects($this->once())->method('getRoles')->will($this->returnValue($roles));
$this->rh->expects($this->once())->method('getReachableRoles')->with($roles)->will($this->returnValue($roles));
$this->token->expects($this->any())->method('getUser')->will($this->returnValue('anon.'));
$permissionDef = new PermissionDefinition(array('view'), 'Kunstmaan\\NodeBundle\\Entity\\Node', 'n');
/* @var $qb QueryBuilder */
$qb = $this->object->apply($queryBuilder, $permissionDef);
$query = $qb->getSQL();
$this->assertContains('"IS_AUTHENTICATED_ANONYMOUSLY"', $query);
}
示例4: add
/**
* Either appends to or replaces a single, generic query part.
*
* The available parts are: 'select', 'from', 'set', 'where',
* 'groupBy', 'having' and 'orderBy'.
*
* @param string $sqlPartName
* @param string $sqlPart
* @param boolean $append
*
* @return self
*/
public function add($sqlPartName, $sqlPart, $append = false)
{
$this->qb->add($sqlPartName, $sqlPart, $append);
return $this;
}