本文整理汇总了PHP中Doctrine\DBAL\Query\QueryBuilder::setParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::setParameters方法的具体用法?PHP QueryBuilder::setParameters怎么用?PHP QueryBuilder::setParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Query\QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::setParameters方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: incorporateDbalQueryBuilder
/**
* @internal
*/
private function incorporateDbalQueryBuilder(QueryBuilder $qb, FilterInterface $filter)
{
$criteria = $this->getFilteringCriteria($filter);
// extraindo os rootAliases, pois o DBAL\QueryBuilder não tem
$fromPart = $qb->getQueryPart('from');
$rootAliases = array();
foreach ($fromPart as $part) {
$rootAliases[] = $part['alias'];
}
$visitor = new DbalQueryExpressionVisitor($qb->getConnection(), $rootAliases, $this->fieldMap);
if ($whereExpression = $criteria->getWhereExpression()) {
$qb->andWhere($visitor->dispatch($whereExpression));
$qb->setParameters($visitor->getParameters());
}
if ($criteria->getOrderings()) {
foreach ($criteria->getOrderings() as $sort => $order) {
$qb->addOrderBy($visitor->getFieldName($sort), $order);
}
}
if (($firstResult = $criteria->getFirstResult()) !== null) {
$qb->setFirstResult($firstResult);
}
if (($maxResults = $criteria->getMaxResults()) !== null) {
$qb->setMaxResults($maxResults);
}
}
示例2: setParametersDelegatesToConcreteQueryBuilder
/**
* @test
*/
public function setParametersDelegatesToConcreteQueryBuilder()
{
$this->concreteQueryBuilder->setParameters(Argument::exact(['aField' => 'aValue']), Argument::exact([]))->shouldBeCalled()->willReturn($this->subject);
$this->subject->setParameters(['aField' => 'aValue']);
}
示例3: setParameters
/**
* Sets a collection of query parameters for the query being constructed.
*
* <code>
* $qb = $conn->getQueryBuilder()
* ->select('u')
* ->from('users', 'u')
* ->where('u.id = :user_id1 OR u.id = :user_id2')
* ->setParameters(array(
* ':user_id1' => 1,
* ':user_id2' => 2
* ));
* </code>
*
* @param array $params The query parameters to set.
* @param array $types The query parameters types to set.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
public function setParameters(array $params, array $types = array())
{
$this->queryBuilder->setParameters($params, $types);
return $this;
}
示例4: setParameters
/**
* Sets a collection of query parameters for the query being constructed.
*
* @param array $params The query parameters to set.
* @param array $types The query parameters types to set.
*
* @return self
*/
public function setParameters(array $params, array $types = [])
{
$this->qb->setParameters($params, $types);
return $this;
}
示例5: setParameters
/**
* paramTypes is private, we need to redefine setParameters
* to access it
*
* @param array $params
* @param array $types
*
* @return $this
*/
public function setParameters(array $params, array $types = array())
{
$this->paramTypes = $types;
return parent::setParameters($params, $types);
}