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

Various properties in FrontendProxyController do not use the Abstract* version but the constructor does #400

Open
AndreasA opened this issue Jul 20, 2023 · 4 comments
Assignees

Comments

@AndreasA
Copy link
Contributor

Describe the bug

If one e.g. decorates the CartOrderRoute by extending the AbstractCartOrderRoute, it will work for the constructor but fails to be stored in the property as the property typehinting only allows CartOrderRoute directly.

The same is true for various other properties / constructor services.

Versions
Shopware version: [e.g. 6.5.4.4]
Plugin version: [e.g. 3.12.1]

see e.g. https://github.com/Adyen/adyen-shopware6/blob/3.12.1/src/Storefront/Controller/FrontendProxyController.php#L54 and https://github.com/Adyen/adyen-shopware6/blob/3.12.1/src/Storefront/Controller/FrontendProxyController.php#L63

@AndreasA
Copy link
Contributor Author

also: is that controller actually necessary? why not just call the store api directly as I think shopware does also?

@peterojo
Copy link
Contributor

peterojo commented Jul 24, 2023

@AndreasA this controller was created only to be able to access store-api routes from our frontend components in shopware 6.5 and this is necessary because of this change

@AndreasA
Copy link
Contributor Author

AndreasA commented Jul 25, 2023

Hi @peterojo

Ok. So did not add another solution regarding proxy routing except to implement a corresponding contorller manually. Weird.

Anyway, my main point was that if I use a service decoration for e.g. Shopware\Core\Checkout\Cart\SalesChannel\CartOrderRoute like:

namespace Foo;

public class DecoratedCartOrderRoute extends AbstractCartOrder {
   ....
}
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"
    xsd:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">
    <services>
        <service id="Foo\DecoratedCartOrderRoute "
            decorates="Shopware\Core\Checkout\Cart\SalesChannel\CartOrderRoute"
        />
    </services>
</container>

Routes like /adyen/proxy-switch-context will fail to work as the controller expects the property to be of the type CartOrderRoute not AbstractCartOrderRoute

@AndreasA
Copy link
Contributor Author

@peterojo I could create a PR for this, it should be quite straight forward.

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

3 participants