Cached proxy classes have no data loaded #7000

Closed
opened 2026-01-22 15:42:54 +01:00 by admin · 1 comment
Owner

Originally created by @jarrettj on GitHub (Jul 6, 2022).

Using:

doctrine/orm 2.7.5
doctrine/doctrine-orm-module 1.1.8

SImply writing results to cache and then reading them. WhenI try to use the objects returned though, it seems that the lazy loaded objects have no data associated with them anymore.

// Register proxy class path for autoloading
// https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/advanced-configuration.html#autoloading-proxies
$proxyDir = __DIR__ . '/src/Application/Proxy';
$proxyNamespace = "Application\Proxy";
Autoloader::register($proxyDir, $proxyNamespace);

Then my cache is simply

// Get it it exists and cache if not found
$mattersAll = $this->cache->fetch('matters-all');
if (!$mattersAll) {
    $mattersAll = $this->getActiveMatters($summary);
    $this->cache->save('matters-all', $mattersAll);
}

It saves and reads it back fine, but for some reason if I try to use the related lazy loaded class to get data it fails and returns null for the data, instead of the values.

Any help would be much appreciated. Thanks.

Regards,
Jarrett

Originally created by @jarrettj on GitHub (Jul 6, 2022). Using: doctrine/orm 2.7.5 doctrine/doctrine-orm-module 1.1.8 SImply writing results to cache and then reading them. WhenI try to use the objects returned though, it seems that the lazy loaded objects have no data associated with them anymore. ``` // Register proxy class path for autoloading // https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/advanced-configuration.html#autoloading-proxies $proxyDir = __DIR__ . '/src/Application/Proxy'; $proxyNamespace = "Application\Proxy"; Autoloader::register($proxyDir, $proxyNamespace); ``` Then my cache is simply ``` // Get it it exists and cache if not found $mattersAll = $this->cache->fetch('matters-all'); if (!$mattersAll) { $mattersAll = $this->getActiveMatters($summary); $this->cache->save('matters-all', $mattersAll); } ``` It saves and reads it back fine, but for some reason if I try to use the related lazy loaded class to get data it fails and returns null for the data, instead of the values. Any help would be much appreciated. Thanks. Regards, Jarrett
admin closed this issue 2026-01-22 15:42:54 +01:00
Author
Owner

@greg0ire commented on GitHub (Jul 6, 2022):

Closing in favor of #9881

@greg0ire commented on GitHub (Jul 6, 2022): Closing in favor of #9881
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7000