本文整理汇总了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;
}