本文整理匯總了PHP中ApacheSolrForTypo3\Solr\Util::isoToTimestamp方法的典型用法代碼示例。如果您正苦於以下問題:PHP Util::isoToTimestamp方法的具體用法?PHP Util::isoToTimestamp怎麽用?PHP Util::isoToTimestamp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ApacheSolrForTypo3\Solr\Util
的用法示例。
在下文中一共展示了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, useful 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 = $this->configuration->getSearchResultsFieldProcessingInstructionsConfiguration();
$availableFields = $document->getFieldNames();
$result = array();
foreach ($availableFields as $fieldName) {
$processingInstruction = $processingInstructions[$fieldName];
// TODO switch to field processors
// TODO allow to have multiple (comma-separated) instructions for each field
switch ($processingInstruction) {
case 'timestamp':
$processedFieldValue = 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 = Template::escapeMarkers($processedFieldValue);
$result[$fieldName] = $processedFieldValue;
}
return $result;
}