ssossossosso

Forums

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

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 pauloasterio 2 years ago.

  • Creator
    Topic
  • #57618
    pauloasterio
    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
  • #57619
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    Hello, pauloasterio.

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

    #57620
    pauloasterio
    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

    #57621
    Yevhen Shyshkin
    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.

    #57622
    pauloasterio
    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 ?

    #57623
    Yevhen Shyshkin
    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)

    #57624
    pauloasterio
    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

    #57625
    Yevhen Shyshkin
    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.

    #57626
    pauloasterio
    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)

You must be logged in to reply to this topic.

ssossossosso