-
-
Save beardcoder/7c4ca2f15841cb715a20cd65cc6ff6bb to your computer and use it in GitHub Desktop.
TYPO3 Solr userFunc IndexQueue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vendor\Extension\Solr\UserFunc; | |
class IndexUserFunc | |
{ | |
/** | |
* This value is automatically inserted by userFunc handling | |
* @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer | |
*/ | |
public $cObj; | |
/** | |
* @param mixed $content | |
* @param array $conf | |
* @return string | |
*/ | |
public function doSomething($content, $conf) { | |
/** @var \TYPO3\CMS\Core\Database\DatabaseConnection $db */ | |
$db = $GLOBALS['TYPO3_DB']; | |
/** @var array $record */ | |
$record = $this->cObj->data; | |
//$conf contains the configuration from typoscript index queue of this field. E.g. someParam | |
$relatedRecord = $db->exec_SELECTgetSingleRow('title', 'mytable', 'local_uid = ' . $record['uid'] . ' AND foo = ' . $conf['someParam.']['myValue']); | |
return $relatedRecord['title']; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugin.tx_solr.index.queue.myType = 1 | |
plugin.tx_solr.index.queue.myType { | |
table = tx_vendor_domain_model_product | |
fields { | |
title = title | |
# more fields | |
myField_stringS = USER | |
myField_stringS.userFunc = Vendor\Extension\Solr\UserFunc\IndexUserFunc->doSomething | |
myField_stringS.someParam < lib.my.stuff | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment