Skip to content

Lazy loading for abstract classes, that have a factory #61095

@mitelg

Description

@mitelg

Symfony version(s) affected

7.3.1

Description

Hey there,

we tried to update to Symfony 7.3 this week and had a strange problem, we couldn't find the reason for until now. I just wanted to know, if this is intended behaviour or a bug.

We have defined a service that is an abstract class. See https://github.com/shopware/shopware/blob/v6.7.0.1/src/Core/Framework/DependencyInjection/cache.xml#L34
As you can see, it has a factory assign, which will decided on the actual implementation. See the services defined above that line.

In 7.2 it works fine, but with the update to 7.3 we needed to remove the lazy loading to make it work again.

The error was:

Cannot instantiate abstract class Shopware\Core\Framework\Adapter\Cache\InvalidatorStorage\AbstractInvalidatorStorage

It would be understandable if an abstract class could not be used for lazy loading. on the other hand there is a factory assigned.

Looking forward to feedback
Best regards 👋

How to reproduce

If you think this could be a bug, I will try to build a reproducer. I am honest and wanted to save some time and not extract the stuff from our project 🙈

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions