Doctrine second level cache

I want to cache Entities with relative tables. I add in my doctrine => orm_default => configuration:

            'query_cache'       => 'memcache',
            'result_cache'      => 'memcache',
            'metadata_cache'    => 'memcache',
            'hydration_cache'   => 'memcache',

            'second_level_cache' => [
                'enabled'               => true,
                'default_lifetime'      => 200,
                'default_lock_lifetime' => 500,
                'file_lock_region_directory' => __DIR__ . '/../src/Application/FileLocks',
                'regions' => [
                    'My\FirstRegion\Name' => [
                        'lifetime'      => 800,
                        'lock_lifetime' => 1000,
                    ],
                    'My\SecondRegion\Name' => [
                        'lifetime'      => 10,
                        'lock_lifetime' => 20,
                    ],
                ],
            ],

And @ORM\Cache(usage=“READ_ONLY”, region=“My\FirstRegion\Name”) to my Entity and Entity relative field description, but when I try to get relative Entity, I get «The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition…» How I can to cache Entity with relative tables access?

1 Like

@Alaksander_A hi there. :slight_smile: I’m struggling with an answer for this as well. Did you find a solution?