本文整理汇总了PHP中Tx_Solr_Util::isoToTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP Tx_Solr_Util::isoToTimestamp方法的具体用法?PHP Tx_Solr_Util::isoToTimestamp怎么用?PHP Tx_Solr_Util::isoToTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tx_Solr_Util
的用法示例。
在下文中一共展示了Tx_Solr_Util::isoToTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processDocumentFieldsToArray
/**
* takes a search result document and processes its fields according to the
* instructions configured in TS. Currently available instructions are
* * timestamp - converts a date field into a unix timestamp
* * serialize - uses serialize() to encode multivalue fields which then can be put out using the MULTIVALUE view helper
* * skip - skips the whole field so that it is not available in the result, usefull for the spell field f.e.
* The default is to do nothing and just add the document's field to the
* resulting array.
*
* @param Apache_Solr_Document $document the Apache_Solr_Document result document
* @return array An array with field values processed like defined in TS
*/
protected function processDocumentFieldsToArray(Apache_Solr_Document $document)
{
$processingInstructions = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_solr.']['search.']['results.']['fieldProcessingInstructions.'];
$availableFields = $document->getFieldNames();
$result = array();
foreach ($availableFields as $fieldName) {
$processingInstruction = $processingInstructions[$fieldName];
// TODO switch to field processors
// TODO allow to have multiple (commaseparated) instructions for each field
switch ($processingInstruction) {
case 'timestamp':
$processedFieldValue = Tx_Solr_Util::isoToTimestamp($document->{$fieldName});
break;
case 'serialize':
if (!empty($document->{$fieldName})) {
$processedFieldValue = serialize($document->{$fieldName});
} else {
$processedFieldValue = '';
}
break;
case 'skip':
continue 2;
default:
$processedFieldValue = $document->{$fieldName};
}
// escape markers in document fields
// TODO remove after switching to fluid templates
$processedFieldValue = Tx_Solr_Template::escapeMarkers($processedFieldValue);
$result[$fieldName] = $processedFieldValue;
}
return $result;
}