ssossossosso

Forums

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

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

  • Creator
    Topic
  • #5784
    Hiro
    Hiro
    Participant

    I need to add Datagrid filter to enable to list Entities having the filter value in ManyToMany field.

    What I have tried:

    As the comment says, I don’t seem to be able to expect DQL to return the parent table data even if the child data does not exist by using LEFT JOIN (Maybe because the child table gets multiple records?).

    Is there a workaround for this situation, like, is there a way to apply subquery using EXISTS only if the filter “ItemCode” is used somehow? If not, is there any timing we can amend the DQL right before the query execution to chuck in the subquery after checking if the filter is ItemCode by creating custom Listener Class or something?

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

    Alexandr Smaga
    Participant

    Hello.

    Not sure that I got your issue well. How you expects this filter to work ?
    Left join will return entity A event if it will have zero associated B entities.
    And if it will have multiple B entities associated, then multiple rows for same entity A will be in results.
    I suggest you are looking for left join with additional WITH condition, something like this

    It’s possible to apply any additional restrictions on query builder in event listeners on oro_datagrid.datagrid.build.after.YOUR_GRID_NAME event.

    #5936
    Hiro
    Hiro
    Participant

    Thank you for the reply.

    As you mentioned, Left Join seems to return Entity A as I have noticed that the issue is not replicated at another development environment. And I think only the difference between the environments is database data.

    Hope there is just missing data going on.

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

You must be logged in to reply to this topic.