Project

General

Profile

Actions

Bug #95899

open

Try to cache an extbase queryResult leads to "Serialization of 'Closure' is not allowed"

Added by Alex Kellner over 2 years ago. Updated over 1 year ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2021-11-07
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I would like to add some caching into my backend views in lux to speed up diagrams.

But in TYPO3 11.5.2 together (with PHP 7.4 or 8.0) I always ran into the exception:
"Serialization of 'Closure' is not allowed"

An example extbase model could be very simple (without any relations or Lazy Loading) with just one string property and extend AbstractEntity. Also the repository function is without magic here:

$query = $this->createQuery();
$query->setLimit(3);
$query->setOrderings(['uid' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING]);
return $query->execute();

If I try to cache the result like

$cacheInstance = GeneralUtility::makeInstance(CacheManager::class)->getCache('bar');
$cacheInstance->set('foo', $queryResult, ['bar'], 100000);

The error is happening:

Any ideas?


Files

closure.png (102 KB) closure.png Alex Kellner, 2021-11-07 12:47
File.php (3.84 KB) File.php Example model Marvin Buchmann, 2022-12-21 08:45
SerializableEntityInterface.php (451 Bytes) SerializableEntityInterface.php Interface Marvin Buchmann, 2022-12-21 08:45
SerializableEntityTrait.php (1.42 KB) SerializableEntityTrait.php Trait Marvin Buchmann, 2022-12-21 08:45

Related issues 1 (1 open0 closed)

Related to TYPO3 Core - Bug #91364: Extbase/CachingFramework - Serialization on 'Closure' is not allowedNew2020-05-12

Actions
Actions

Also available in: Atom PDF