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

Fix Notice: Undefined index: operator in addConditionGroup #38

Open
wants to merge 1 commit into
base: 8.x-1.x
Choose a base branch
from

Conversation

MurzNN
Copy link
Contributor

@MurzNN MurzNN commented Nov 11, 2020

When executing queries with ConditionGroup, that doesn't contain operator (that is not required), Drupal shows the notice:

Notice: Undefined index: operator in Drupal\graphql_search_api\Plugin\GraphQL\Fields\SearchAPISearch->addConditionGroup() (line 172 of web/modules/contrib/graphql_search_api/src/Plugin/GraphQL/Fields/SearchAPISearch.php).

Here is fix for this notice. Instead of if checking, I use the ?? construction, that must be available in PHP 7.0+

Also value may be not required too (for example, if operator = "IS_NULL"), so I add NULL replacement to it.

When executing queries with ConditionGroup, that doesn't contain operator (that is not required), Drupal shows the notice:
```
Notice: Undefined index: operator in Drupal\graphql_search_api\Plugin\GraphQL\Fields\SearchAPISearch->addConditionGroup() (line 172 of web/modules/contrib/graphql_search_api/src/Plugin/GraphQL/Fields/SearchAPISearch.php).
```
Here is fix for this notice. Instead of `if` checking, I use the `??` construction, that must be available in PHP 7.0+

Also `value` may be not required too, so I add `NULL` replacement to it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant