本文整理汇总了PHP中SMWQuery::getQuerySource方法的典型用法代码示例。如果您正苦于以下问题:PHP SMWQuery::getQuerySource方法的具体用法?PHP SMWQuery::getQuerySource怎么用?PHP SMWQuery::getQuerySource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SMWQuery
的用法示例。
在下文中一共展示了SMWQuery::getQuerySource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* @since 2.5
*
* @param Query $query
*
* @return string
*/
public static function get(Query $query)
{
$serialized = array();
$serialized['conditions'] = $query->getQueryString();
$serialized['parameters'] = array('limit=' . $query->getLimit(), 'offset=' . $query->getOffset(), 'mainlabel=' . $query->getMainlabel());
if ($query->getQuerySource() !== null && $query->getQuerySource() !== '') {
$serialized['parameters'] = array_merge($serialized['parameters'], array('source=' . $query->getQuerySource()));
}
list($serialized['sort'], $serialized['order']) = self::doSerializeSortKeys($query);
$serialized['printouts'] = self::doSerializePrintouts($query);
$encoded = $serialized['conditions'] . '|' . ($serialized['printouts'] !== array() ? implode('|', $serialized['printouts']) . '|' : '') . implode('|', $serialized['parameters']) . ($serialized['sort'] !== array() ? '|sort=' . implode(',', $serialized['sort']) : '') . ($serialized['order'] !== array() ? '|order=' . implode(',', $serialized['order']) : '');
return $encoded;
}
示例2: toArray
/**
* Returns a serialized SMWQueryResult object with additional meta data
*
* This methods extends the serializeToArray() for additional meta
* that are useful when handling data via the api
*
* @note should be used instead of SMWQueryResult::serializeToArray()
* as this method contains additional informaion
*
* @since 1.9
*
* @return array
*/
public function toArray()
{
// @note micro optimization: We call getSerializedQueryResult()
// only once and create the hash here instead of calling getHash()
// to avoid getSerializedQueryResult() being called again
// @note count + offset equals total therefore we deploy both values
$serializeArray = $this->serializeToArray();
return array_merge($serializeArray, array('meta' => array('hash' => HashBuilder::createHashIdForContent($serializeArray), 'count' => $this->getCount(), 'offset' => $this->mQuery->getOffset(), 'source' => $this->mQuery->getQuerySource())));
}