Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None

      Description

      Allow filters to add join tables to sql queries for filtering.

      Let's have Brand entity, and BrandText entity. Text is localisation for each Brand. If there is no BrandText with bt.isPublic and bt.web_id = 123 I wanna filter it globally and not even allow to load Brand entity.

      This cannot be solved by using DQL, because I need to affect lazily loaded associations, for example in templates

      Accessing $product->brand-> in template should resolve to NULL, when there is no BrandText.isPublic = 1.

      This could be solved by allowing filters to add joins to queries. Should I prepare a pull request?

        Activity

        Filip Procházka created issue -
        Filip Procházka made changes -
        Field Original Value New Value
        Labels filter, filters, join, joins, filter filters join joins
        Filip Procházka made changes -
        Description Allow filters to add join tables to sql queries for filtering.

        Let's have Brand entity, and BrandText entity. Text is localisation for each Brand. If there is no BrandText with bt.isPublic d bt.web_id = 123 I wanna filter it globally and not even allow to load Brand entity.

        This cannot be solved by using DQL, because I need to affect lazily loaded associations, for example in templates

        Accessing $product->brand-> in template should resolve to NULL, when there is no BrandText.isPublic = 1.
        Allow filters to add join tables to sql queries for filtering.

        Let's have Brand entity, and BrandText entity. Text is localisation for each Brand. If there is no BrandText with bt.isPublic and bt.web_id = 123 I wanna filter it globally and not even allow to load Brand entity.

        This cannot be solved by using DQL, because I need to affect lazily loaded associations, for example in templates

        Accessing $product->brand-> in template should resolve to NULL, when there is no BrandText.isPublic = 1.
        Filip Procházka made changes -
        Description Allow filters to add join tables to sql queries for filtering.

        Let's have Brand entity, and BrandText entity. Text is localisation for each Brand. If there is no BrandText with bt.isPublic and bt.web_id = 123 I wanna filter it globally and not even allow to load Brand entity.

        This cannot be solved by using DQL, because I need to affect lazily loaded associations, for example in templates

        Accessing $product->brand-> in template should resolve to NULL, when there is no BrandText.isPublic = 1.
        Allow filters to add join tables to sql queries for filtering.

        Let's have Brand entity, and BrandText entity. Text is localisation for each Brand. If there is no BrandText with bt.isPublic and bt.web_id = 123 I wanna filter it globally and not even allow to load Brand entity.

        This cannot be solved by using DQL, because I need to affect lazily loaded associations, for example in templates

        Accessing $product->brand-> in template should resolve to NULL, when there is no BrandText.isPublic = 1.

        This could be solved by allowing filters to add joins to queries. Should I prepare a pull request?
        Show
        Oleg Namaka added a comment - Duplicates http://www.doctrine-project.org/jira/browse/DDC-2220
        Show
        Filip Procházka added a comment - http://www.doctrine-project.org/jira/browse/DDC-2220
        Filip Procházka made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Duplicate [ 3 ]
        Hide
        Filip Procházka added a comment -

        Because the DDC-2220 is closed.

        Show
        Filip Procházka added a comment - Because the DDC-2220 is closed.
        Filip Procházka made changes -
        Resolution Duplicate [ 3 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Hide
        Benjamin Eberlei added a comment -

        We won't add this feature.

        Show
        Benjamin Eberlei added a comment - We won't add this feature.
        Benjamin Eberlei made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]
        Hide
        Filip Procházka added a comment -

        I don't understand it... Think about it once again, you've never used inner joins, or left joins with where is null for filtering results?

        Show
        Filip Procházka added a comment - I don't understand it... Think about it once again, you've never used inner joins, or left joins with where is null for filtering results?
        Hide
        Filip Procházka added a comment -

        And I don't what the ugly api that is mentioned in DDC-2220, I wanna addFilterJoin method here, next to addFilterConstraint https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/Filter/SQLFilter.php#L128

        Ok then, you're not going to support this, let's assume you have good reasons for it. What are the alternatives? If you give me working filtering alternative based on WHERE statements what won't kill the server performance I'm going to give up on this issue.

        Show
        Filip Procházka added a comment - And I don't what the ugly api that is mentioned in DDC-2220 , I wanna addFilterJoin method here, next to addFilterConstraint https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Query/Filter/SQLFilter.php#L128 Ok then, you're not going to support this, let's assume you have good reasons for it. What are the alternatives? If you give me working filtering alternative based on WHERE statements what won't kill the server performance I'm going to give up on this issue.
        Hide
        Filip Procházka added a comment -

        Have there at least been some discussion somewhere I can read it? So I can understand why you don't like this? The "We won't add this feature." isn't a reason.

        // Btw, jira could really use some comment edits...

        Show
        Filip Procházka added a comment - Have there at least been some discussion somewhere I can read it? So I can understand why you don't like this? The "We won't add this feature." isn't a reason. // Btw, jira could really use some comment edits...
        Hide
        Benjamin Eberlei added a comment -

        Filip Procházka You can use a subselect, but we cannot extend the filters to add joins for technical reasons. An implementation would raise the complexity for all the code, not just the one affected by filters.

        You could try to return a JOIN from 'addFilterConstraint', but I am not sure if that works (and i would recommend it)

        Show
        Benjamin Eberlei added a comment - Filip Procházka You can use a subselect, but we cannot extend the filters to add joins for technical reasons. An implementation would raise the complexity for all the code, not just the one affected by filters. You could try to return a JOIN from 'addFilterConstraint', but I am not sure if that works (and i would recommend it)

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-2404, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Filip Procházka
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: