-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
Allow constraining allowed relations in @whereConditions
and @whereHasConditions
#1896
base: master
Are you sure you want to change the base?
Conversation
# Conflicts: # CHANGELOG.md
# Conflicts: # CHANGELOG.md # src/WhereConditions/WhereConditionsServiceProvider.php
@whereConditions
and @whereHasConditions
@LastDragon-ru please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for delay. Looks good I think 👍
…ions' into constrain-where-conditions-relations
@@ -129,10 +155,18 @@ input QueryPeopleWhereWhereConditionsRelation { | |||
"Additional condition logic." | |||
condition: QueryPeopleWhereWhereConditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized that this is nonsensical when combined with columnsEnum
. The allowed columns of the original model are used for the relations as well.
We need to find a solution that either has a separate input that allows columns as strings for relations, or an even more sophisticated solution that has enums for the relations. Configuration could look like this:
@whereConditions(relations: [
{ name: "friends", columns: ["name", "age"] }
{ name: "friends.friends", columns: ["name", "age"] }
])
input QueryPeopleWhereWhereConditionsRelation {
friends: QueryPeopleWhereWhereConditionsFriendsConditions
friendsFriends: QueryPeopleWhereWhereConditionsFriendsFriendsConditions
}
input QueryPeopleWhereWhereConditionsFriendsConditions{
column: QueryPeopleWhereWhereConditionsFriendsColumn
operator: SQLOperator = EQ
value: Mixed
AND: [QueryPeopleWhereWhereConditionsFriendsConditions!]
OR: [QueryPeopleWhereWhereConditionsFriendsConditions!]
}
enum QueryPeopleWhereWhereConditionsFriendsConditions {
NAME
AGE
}
Is this abandoned? Do we have a way to define the column names for relations? |
You can try @searchBy directive ;) |
Are there any chances of this being integrated into core? |
Maybe in the future, please see #1782 (comment) |
#1754
Changes
Allow constraining the allowed relations to an
enum
via the directive argumentsrelations
andrelationsEnum
in@whereConditions
and@whereHasConditions
. This works analogous tocolumns
andcolumnsEnum
.Breaking changes
None.