本文整理汇总了PHP中Doctrine\ORM\QueryBuilder::innerjoin方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::innerjoin方法的具体用法?PHP QueryBuilder::innerjoin怎么用?PHP QueryBuilder::innerjoin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::innerjoin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: join
protected function join(QueryBuilder $qb, $add = false)
{
$qb->innerjoin('user.user', 'securityUser');
$qb->leftjoin('user.activities', 'activities');
$qb->leftjoin('user.assignedAccount', 'assignedAccount');
$qb->leftjoin('assignedAccount.end', 'assignedAccount_end');
$qb->leftjoin('user.agencies', 'agencies');
$qb->leftjoin('agencies.agency', 'agency');
$qb->leftjoin('agencies.end', 'agencies_end');
if ($add) {
$qb->addSelect('securityUser');
$qb->addSelect('assignedAccount');
$qb->addSelect('agencies');
$qb->addSelect('agency');
$qb->addSelect('agencies_end');
$qb->addSelect('assignedAccount_end');
}
return $qb;
}
示例2: hydrateQuery
/**
* Hydrate query
*
* @param QueryBuilder $query
*
* @return QueryBuilder
*/
private function hydrateQuery($query)
{
foreach ($this->joins as $join) {
$query->innerjoin($join['relation'] . ' ' . $join['alias'], $join['on']);
}
foreach ($this->wheres as $where) {
if ($where['type'] == null) {
$query->andWhere($where['alias'] . '.' . $where['property'] . ' = :v' . $this->index)->setParameter('v' . $this->index, $where['value']);
} else {
switch ($where['type']) {
case 'LIKE':
$query->andWhere($where['alias'] . '.' . $where['property'] . ' LIKE :v' . $this->index)->setParameter('v' . $this->index, '%' . $where['value'] . '%');
break;
case 'OR_LIKE':
$expr = $query->expr()->orX();
foreach ($where['property'] as $property) {
$expr->add($query->expr()->like($property['property'], ':v' . $this->index));
$query->setParameter('v' . $this->index, $property['value']);
$this->index++;
}
$query->andWhere($expr);
break;
case 'MIN':
$query->andWhere($where['alias'] . '.' . $where['property'] . ' >= :v' . $this->index)->setParameter('v' . $this->index, '%' . $where['value'] . '%');
break;
}
}
$this->index++;
}
return $query;
}