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  Bernhard Kau 1 year, 11 months ago.

  • Creator
    Topic
  • #12107

    Bernhard Kau
    Participant

    I am just started using the OroPlatform (and Symfony in general) and right now most things I can figure out. But one thing I don’t like with the datagrids. When you want to filter out all entity item, that do not belong to the current user, you have to do something like this in the “datagrid.yml” file:

    So the filter to hide entity items, that should not be shown do any user, you have to make sure to filter your datagrid accordingly. I also added an additional datagrid for a dashboard widget, where I had to add the exact same “where” clause.

    My question is: Can I filter the entity item somewhere more central, so that a developer cannot accidentally forget the filter, when he creates a datagrid (or any other view, that queries entity item). I haven’t used entity repositories, providers or things like that. Would it be possible to filter the items in such classes?

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

    Vova Soroka
    Oro Core

    Hello Bernhard!

    One of solutions is to use query hints. Please look at
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/EntityBundle/Resources/doc/query_hint_resolver.md
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/DataGridBundle/Resources/doc/backend/datasources/orm.md#query-hints

    Here is an example

    #12120

    Bernhard Kau
    Participant

    Hey thanks for your reply Vova! That still would require a developer not to forget to add the “hints”, but it’s still a pretty neat functionality as the WHERE will be more complex as the application get’s more functionailty and you than only have to update the hint. Thanks a lot!

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

You must be logged in to reply to this topic.