Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to add additional filters for relation #76

Open
sukhwinder33445 opened this issue Aug 29, 2022 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@sukhwinder33445
Copy link
Contributor

There should be a method like Relation::additionalFilter() to join table.

Use case

In the partnerportal I join contracts to a customer. It would be nice to have an additional filter to join only non-archived contracts.

Example

Customer::createRelations(Relations $relations)
    {
        $relations
              ->hasMany('contract', Contract::class)
              ->additionalFilter('contract.archived', 0)
              ->setJoinType('LEFT');
    }
@nilmerg
Copy link
Member

nilmerg commented Sep 24, 2024

There are now more cases coming up which require such a functionality. In Icinga DB Web this is generally a problem, because there are multiple tables which have a host_id and a service_id. For services, the host_id is also set and so there's no way to differentiate host and service rows during a join.

Example:
Icinga/icingadb-web#1055 (review)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants