PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, March 12, 2022

[FIXED] How to prority route

 March 12, 2022     shopware, shopware6, symfony, symfony5     No comments   

Issue

I have overwritten the controller in the application by overwritten route and it works, but also installed another plugin that overwritten the same route as I overwritten (this plugin cannot be changed) and now this route is supported by the shopware, not mine.

this is my controller I want to display

namespace MyPlugin\Core\Checkout\Customer\SalesChannel;

...
class ChangeCustomerProfileRoute extends AbstractChangeCustomerProfileRoute
{
     * @Route(path="/store-api/account/change-profile", name="store-api.account.change-profile", methods={"POST"})
     */
    public function change(RequestDataBag $data, SalesChannelContext $context, CustomerEntity $customer): SuccessResponse

...

this is controller in a another plugin -I don’t want to show it (I need this plugin because I need functionalities, but I don’t need this route)

namespace StorePlugin\Core\Checkout\Customer\SalesChannel;

...
class ChangeCustomerProfileRoute extends AbstractChangeCustomerProfileRoute
{
     * @Route(path="/store-api/account/change-profile", name="store-api.account.change-profile", methods={"POST"})
     */
    public function change(RequestDataBag $data, SalesChannelContext $context, CustomerEntity $customer): SuccessResponse

...

I have read this article https://symfony.com/blog/new-in-symfony-5-1-route-annotations-priority but it does not work because this do not prioritize the name, only url.

How can I prioritize my route name to be supported by shopware?


Solution

The priority should be dependent on the plugin loading order, which is determined by the installation date.

Try to install the plugin in a different order. You could also manually change the installation date in the plugin table in the database.



Answered By - Alex
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing