ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

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

  • Creator
    Topic
  • #3909

    keganv
    Participant

    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
    Replies
  • #3929
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    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.

    #3930

    keganv
    Participant

    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)

You must be logged in to reply to this topic.