Currently the chosen storage pid in plug-in settings is not used for the studycourses query. The following changes should be made:
StudyCourseController.php:
Instead of
$studyCourses = $this->courseService->findBySearchOptions(
$this->filterService->resolveFilterPropertyPath($searchOptions)
);
It should be
$studyCourses = $this->courseService->findBySearchOptions(
$this->filterService->resolveFilterPropertyPath($searchOptions),
$currentPluginRecord
);
CourseService.php:
Instead of
public function findBySearchOptions(array $searchOptions,$pluginRecord): array
{
$cacheInstance = CacheUtility::getCacheInstance();
$cacheIdentifier = CacheUtility::getCacheIdentifierForStudyCourses($searchOptions,$pluginRecord);
$studyCourses = $cacheInstance->get($cacheIdentifier);
if (!$studyCourses) {
$studyCourses = $this->studyCourseRepository->findAllFilteredByOptions($searchOptions, $pluginRecord);
$cacheInstance->set($cacheIdentifier, $studyCourses, ['in2studyfinder']);
}
return $studyCourses;
}
It should be
public function findBySearchOptions(array $searchOptions,$pluginRecord): array
{
$cacheInstance = CacheUtility::getCacheInstance();
$cacheIdentifier = CacheUtility::getCacheIdentifierForStudyCourses($searchOptions,$pluginRecord);
$studyCourses = $cacheInstance->get($cacheIdentifier);
if (!$studyCourses) {
$studyCourses = $this->studyCourseRepository->findAllFilteredByOptions($searchOptions, $pluginRecord);
$cacheInstance->set($cacheIdentifier, $studyCourses, ['in2studyfinder']);
}
return $studyCourses;
}
StudyCourseRepository:
Instead of
public function findAllFilteredByOptions($options): array
{
$query = $this->createQuery();
$query->getQuerySettings()->setStoragePageIds($this->extensionSettings->getConfiguredStoragePids());
It should be
public function findAllFilteredByOptions($options,$pluginRecord): array
{
$query = $this->createQuery();
//$query->getQuerySettings()->setStoragePageIds($this->extensionSettings->getConfiguredStoragePids());
$storagePids = $this->extensionSettings->getConfiguredStoragePids($pluginRecord);
/** EXTREM WICHTIG: QuerySettings klonen */
$querySettings = clone $query->getQuerySettings();
$querySettings->setStoragePageIds($storagePids);
$query->setQuerySettings($querySettings);
CacheUtility.php:
Instead of:
public static function getCacheIdentifierForStudyCourses(array $options): string
{
// create cache Identifier
$optionsIdentifier = $options === [] ? 'allStudyCourses' : json_encode($options, JSON_THROW_ON_ERROR);
return md5(
FrontendUtility::getCurrentPageIdentifier()
. '-'
. FrontendUtility::getCurrentSysLanguageUid()
. '-'
. $optionsIdentifier
);
}
It should be
public static function getCacheIdentifierForStudyCourses(
array $searchOptions,
array $pluginRecord
): string {
return sha1(
json_encode([
'search' => $searchOptions,
'plugin' => [
'uid' => $pluginRecord['uid'] ?? 0,
'pages' => $pluginRecord['pages'] ?? '',
],
])
);
}
TYPO3 13.4.27
in2studyfinder 13.1.1 (current version is the same)
Patches:
CacheUtility.txt
CourseService.txt
StudyCourseController.txt
StudyCourseRepository.txt
FilterService.txt
Currently the chosen storage pid in plug-in settings is not used for the studycourses query. The following changes should be made:
StudyCourseController.php:
Instead of
It should be
CourseService.php:
Instead of
It should be
StudyCourseRepository:
Instead of
It should be
CacheUtility.php:
Instead of:
It should be
TYPO3 13.4.27
in2studyfinder 13.1.1 (current version is the same)
Patches:
CacheUtility.txt
CourseService.txt
StudyCourseController.txt
StudyCourseRepository.txt
FilterService.txt