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  sndpl 3 years, 1 month ago.

  • Creator
    Topic
  • #2643

    sndpl
    Participant

    Hi,

    I have a positions entity that can belong to one or more categories. So on the view/update of a position I want to show a grid with the categories.

    In my position view template I have the following:

    In the widget template:

    In the controller:
    /**
    * @Route("/widget/categories/{id}", name="position_widget_categories", requirements={"id"="\d+"})
    * @Template()
    */
    public function categoriesAction(Position $position)
    {
    return ['entity' => $position];
    }

    and in my categories grid i use the following query (in datagrid.yml):

    But the :position is never replaced with the position id. I’m a missing something?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #2644

    Alexandr Smaga
    Participant

    Hi.

    Yes, event listener should be registered to fill value from request to query.
    SERVICE_ID:
    class: %oro_datagrid.event_listener.base_orm_relation.class%
    arguments:
    - 'position' # YOUR QUERY PARAM NAME
    - @oro_datagrid.datagrid.request_params
    tags:
    - { name: kernel.event_listener, event: oro_datagrid.datgrid.build.after.YOUR_GRID_NAME, method: onBuildAfter }

    #2647

    sndpl
    Participant

    Thanks for the quick reply, it works now!!

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

You must be logged in to reply to this topic.