本文整理汇总了PHP中QueryBuilder::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::execute方法的具体用法?PHP QueryBuilder::execute怎么用?PHP QueryBuilder::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::execute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
/**
* Fetch
*
* @return DocumentCollection A collection of the documents returned by the query
*/
public function fetch()
{
$pluckIds = function ($item) {
return $item['id'];
};
$results = $this->queryBuilder->execute()->fetchAll();
$ids = array_map($pluckIds, $results);
return new DocumentCollection($ids, $this->librarian);
}
示例2: getMostSubmitted
/**
* Get list of forms ordered by it's count
*
* @param QueryBuilder $query
* @param integer $limit
* @param integer $offset
*
* @return array
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function getMostSubmitted($query, $limit = 10, $offset = 0, $column = 'fs.id', $as = 'submissions')
{
$asSelect = $as ? ' as ' . $as : '';
$query->select('f.name as title, f.id, count(distinct ' . $column . ')' . $asSelect)->groupBy('f.id, f.name')->orderBy($as, 'DESC')->setMaxResults($limit)->setFirstResult($offset);
$results = $query->execute()->fetchAll();
return $results;
}
示例3: getMostEmails
/**
* Get pie graph data for Sent, Read and Failed email count
*
* @param QueryBuilder $query
*
* @return array
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function getMostEmails($query, $limit = 10, $offset = 0)
{
$query->setMaxResults($limit)->setFirstResult($offset);
$results = $query->execute()->fetchAll();
return $results;
}
示例4: countValue
/**
* Count a value in a column
*
* @param QueryBuilder $query
*
* @return array
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function countValue($query, $column, $value)
{
$query->select('count(' . $column . ') as quantity')->from(MAUTIC_TABLE_PREFIX . 'leads', 'l')->leftJoin('l', MAUTIC_TABLE_PREFIX . 'lead_points_change_log', 'lp', 'lp.lead_id = l.id')->andwhere($query->expr()->eq($column, ':value'))->setParameter('value', $value);
$result = $query->execute()->fetch();
return $result['quantity'];
}
示例5: getHttpStatuses
/**
* Get pie graph data for http statuses
*
* @param QueryBuilder $query
*
* @return array
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function getHttpStatuses($query)
{
$query->select('ad.code as status, count(ad.code) as count')->groupBy('ad.code')->orderBy('count', 'DESC');
$results = $query->execute()->fetchAll();
$colors = GraphHelper::$colors;
$graphData = array();
$i = 0;
foreach ($results as $result) {
if (!isset($colors[$i])) {
$i = 0;
}
$color = $colors[$i];
$graphData[] = array('label' => $result['status'], 'color' => $colors[$i]['color'], 'highlight' => $colors[$i]['highlight'], 'value' => (int) $result['count']);
$i++;
}
return $graphData;
}
示例6: getHttpStatuses
/**
* Get pie graph data for http statuses
*
* @param QueryBuilder $query
*
* @return array
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*/
public function getHttpStatuses($query)
{
$query->select('ad.code as status, count(ad.code) as count')->groupBy('ad.code')->orderBy('count', 'DESC');
$results = $query->execute()->fetchAll();
$chart = new PieChart();
foreach ($results as $result) {
$chart->setDataset($result['status'], $result['count']);
}
return $chart->render();
}