本文整理汇总了PHP中eZ\Publish\Core\Persistence\Database\SelectQuery::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::prepare方法的具体用法?PHP SelectQuery::prepare怎么用?PHP SelectQuery::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\Core\Persistence\Database\SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::prepare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listVersionsHelper
/**
* Helper for {@see listVersions()} and {@see listVersionsForUser()} that filters duplicates
* that are the result of the cartesian product performed by createVersionInfoFindQuery().
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
*
* @return string[][]
*/
private function listVersionsHelper(SelectQuery $query)
{
$query->orderBy($this->dbHandler->quoteColumn('id', 'ezcontentobject_version'));
$statement = $query->prepare();
$statement->execute();
$results = array();
$previousId = null;
foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
if ($row['ezcontentobject_version_id'] == $previousId) {
continue;
}
$previousId = $row['ezcontentobject_version_id'];
$results[] = $row;
}
return $results;
}
示例2: assertQueryResult
/**
* Assert query result as correct.
*
* Builds text representations of the asserted and fetched query result,
* based on a eZ\Publish\Core\Persistence\Database\SelectQuery object. Compares them using classic diff for
* maximum readability of the differences between expectations and real
* results.
*
* The expectation MUST be passed as a two dimensional array containing
* rows of columns.
*
* @param array $expectation
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param string $message
*/
public static function assertQueryResult(array $expectation, SelectQuery $query, $message = null)
{
$statement = $query->prepare();
$statement->execute();
$result = array();
while ($row = $statement->fetch(\PDO::FETCH_ASSOC)) {
$result[] = $row;
}
return self::assertEquals(self::getResultTextRepresentation($expectation), self::getResultTextRepresentation($result), $message);
}
示例3: loadData
/**
* Loads field data for given $pass.
*
* @param \eZ\Publish\Core\Persistence\Database\SelectQuery $query
* @param int $bulkCount
* @param int $pass
*
* @return array
*/
protected function loadData(SelectQuery $query, $bulkCount, $pass)
{
$query->limit($bulkCount, $pass * $bulkCount);
$stmt = $query->prepare();
$stmt->execute();
return $stmt->fetchAll(PDO::FETCH_ASSOC);
}