OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions How to delete using controller action in new entity

This topic contains 2 replies, has 2 voices, and was last updated by  keganv 6 years, 4 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
  • #35670


    I’ve created a new bundle and entity, on my show page for the entity I’ve used the Oro way of placing the buttons at the top in the navButtons block. The delete button always gives me the following error: No route found for “DELETE /entity/”: Method Not Allowed (Allow: GET, HEAD).

    I see that Oro seems to always use the API for deleting. Is there a way to use the standard deleteAction in my controller with the UI.deleteButton?

    My method annotation on my deleteAction is @Method({"GET", "HEAD", "DELETE"}). Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #35671
    Yevhen Shyshkin
    Yevhen Shyshkin

    Hello, keganv.

    If you want to use API deletion, you should implement appropriate REST API controller and use it (see https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/UserBundle/Controller/Api/Rest/UserController.php#L141 for example).

    If you want to implement your own delete without API, you have to use regular GET request that will delete entity and redirect user back to grid. This regular action button can be rendered on view page with a regular button (UI.button).

    Using of REST API is preferrable, because OroCRM already has all built in features to process it – confirmations, deletion messages etc. However, you can add your own processing and use it.



    Thanks Yevhen, I’ve decided to go ahead and set up the REST API controller. As you stated, I was easily able to add my own functionality. However, I wanted to take advantage of everything the platform offers, so the API seems best practice. Thanks for your answer!

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

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

Yes No