OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions Override contact or any api

This topic contains 8 replies, has 2 voices, and was last updated by  pauloasterio 8 years, 1 month ago.

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

  • Creator
    Topic
  • #28749

    pauloasterio
    Participant

    I have overriden the contact Bundle so the /contact is now getting my custom templates, my question is how do I override the /api/rest route so it can reach the api/rest controllers on my custom bundle ?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Author
    Replies
  • #28750

    Yevhen Shyshkin
    Participant

    Hello, pauloasterio.

    You can use the same approach – override routing and controllers in your custom bundle. See http://oroinc.com/orocrm/doc/current/cookbook/how-to-extend-existing-bundle and http://symfony.com/doc/2.7/cookbook/bundles/inheritance.html#overriding-controllers

    #28751

    pauloasterio
    Participant

    thanks for your response !

    maybe I am getting a syntax confusion, I am still not getting the route to my local api controller! can you help me ?

    this is my @CustomBundle/config/oro/routing.yml

    this is my @CustomBundle/config/oro/routing_api.yml

    #28752

    Yevhen Shyshkin
    Participant

    Using these configuration files you said Symfony to use controllers from ContactBundle, because “@!OroCRMContactBundle” means that Symfony will not use bundle inheritance to resolve path.

    If you need to override controller you can simply remove these two files and create your controller with the same name and in the same directory as the original one.

    #28753

    pauloasterio
    Participant

    thank you worked! I was able to override the API.

    I am just with another problem, I am trying to override contacts main datagrid, when I copy the datagrid.yml to my bundle, I get an empty contact grid! All I did in this new bundle was to copy the api controller and now I am trying to customize the grid columns. can you help ?

    #28754

    Yevhen Shyshkin
    Participant

    There are two ways to do that:

    1) by overriding of whole template – you have to create grid in your bundle (you can extend existing one or create new from scratch), then override template of index page (index.html.twig) and render your grid instead of the default one;

    2) by customizing of original grid – you have to create listener to the one of datagrid events, e.g. build.pre, and alter configuration there (example https://github.com/orocrm/crm/blob/d11222bb360362b778d62b0e25a0dd6e252304ab/src/OroCRM/Bundle/MagentoBundle/Resources/config/services.yml#L488)

    #28755

    pauloasterio
    Participant

    Hi Yevhen,

    My setup is the like this

    https://www.dropbox.com/s/5cpi07j96p168yz/printScreen.png?dl=0

    And I still getting a blank contact grid, what am I missing?

    Appreciate your help.

    tks

    #28756

    Yevhen Shyshkin
    Participant

    Directory structure looks fine, so your issue related either to template, or to grid itself. Please, check the template used to render index page, if nothing there – check grid itself. Also it might be useful to look at application, PHP and web-server logs – there might be some clues.

    #28757

    pauloasterio
    Participant

    Hello,

    I got it fixed just by changing the grid name on the datagrid.yml and the twig template that renders it.

    thank you for your response.

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

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

Back to top