Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing options['object_manager'] in AsResource configuration #947

Open
next-sentence opened this issue Oct 1, 2024 · 1 comment
Open

Comments

@next-sentence
Copy link

With yaml format it is possible to set custom object manager per resourse, like this

sylius_resource:
    resources:
        app.book:
            options:
                object_manager: custom
            classes:
                model: App\Entity\Book

but with attributes it is not possible, so you have to duplicate the config

@loic425
Copy link
Member

loic425 commented Oct 3, 2024

Hi, thanks for opening this issue.

In the "legacy mode", this configuration is useful (So I guess you need this for a Sylius E-commerce resource).
But not with new operations' system.

If your resource is a Doctrine entity, the configured manager will be retrieve like this
https://github.com/Sylius/SyliusResourceBundle/blob/1.12/src/Component/src/Doctrine/Common/State/PersistProcessor.php#L53

If your resource is a not a Doctrine one, you will have to define a processor in your operations to store the data yourself in your persistence system (elastic search, or whatever).

So I will not want to implement this on new AsResource attribute, cause this configuration will be removed at some point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants