OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce Orocommerce (3.1.9): Overriding Api-Rest-Controller problem

This topic contains 1 reply, has 1 voice, and was last updated by  Frank 4 months, 1 week ago.

  • Creator
    Topic
  • #40093

    Frank
    Participant

    Hi there,

    I have an identical question as ‘kroder’ 2 years ago, but the solution (which worked fine for kroder) does not work for me:
    https://forum.oroinc.com/oro-platform/oro-platform-programming-questions/topic/override-one-controller-from-core-bundle-and-keep-apirest-controllers

    My target controller, I want to override (define some custom actions) is:
    OroShoppingListBundle/Controller/Frontend/Api/Rest/ShoppingListController.php

    My steps are:

    1. Create custom routing.yml

    2. Create custom routing_api.yml

    3. Extend Api-Rest-Controller

    Remarks:
    – resource: “@!MyShoppingListBundle/ …” works fine with other controller-extensions for oro 3.1.9.,
    however I have checked resource: “@MyShoppingListBundle/ …” with the same result/error (see below).
    – empty extended custom controller should work with the identical functionality as the core oro controller (empty is for testing only).

    Error-message (Console): ‘no oro_api_set_shopping_list_current` found!


    Some Modification:

    Step 1 as above
    Step 2 as above
    Step 3 modification as following:

    Copy:
    Oro\Bundle\ShoppingListBundle\Controller\Frontend\Api\Rest\ShoppingListController
    to
    MyShoppingListBundle\Controller\Frontend\Api\Rest\ShoppingListController (=copy)

    Result is
    -> no errors/full functionality. But
    -> Oro\Bundle\ShoppingListBundle\Controller\Frontend\Api\Rest\ShoppingListController is used, and
    -> MyShoppingListBundle\Controller\Frontend\Api\Rest\ShoppingListController (copy) is ignored.

    Something is going wrong with the routing. But I don’t know what. Could you be so kind, and give me some hint/advice?

    Thanks in advance
    Frank

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #40094

    Frank
    Participant

    SOLUTION:

    Debugging Symfony’s Router with:

    shows my some strange route:

    Now, it is clear (and easy):
    The router builds the route from the Controller-Class-/or FileName. So, I have changed both to

    And, overridung works!

    Thanks for watching.
    Frank

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No