Skip to content

Fix alias for mutation function #817

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

Merged
merged 4 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/definitions/expression-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ Examples:

> The signature of this function is changed since version 0.14.
> The old signature is <code><b>mutation</b>(string <b>$alias</b>, array <b>$args</b> = []): mixed</code>, which is not used anymore.
> The alias is also changed from `mut` to `m`.

Calls a method on the tagged service `overblog_graphql.mutation` passing `$args` as arguments.

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/expression_language_functions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:

expression_function.mutation_alias:
class: Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\GraphQL\Mutation
arguments: { $name : 'mut' }
arguments: { $name : 'm' }

expression_function.query_alias:
class: Overblog\GraphQLBundle\ExpressionLanguage\ExpressionFunction\GraphQL\Query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Mutation:
fields:
cascadeOnScalar:
type: Boolean
resolve: '@=mut("mutation_mock", args, validator)'
resolve: '@=m("mutation_mock", args, validator)'
args:
test:
type: "String"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Mutation:
fields:
constraintDoesNotExist:
type: Boolean
resolve: '@=mut("mutation_mock", [args, validator])'
resolve: '@=m("mutation_mock", args, validator)'
args:
username:
type: "String"
Expand Down
20 changes: 10 additions & 10 deletions tests/Functional/App/config/validator/mapping/Mutation.types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Mutation:
complexity: 1
public: true
type: Boolean
resolve: "@=mut('no_validation')"
resolve: "@=m('no_validation')"
args:
username:
type: String!
Expand All @@ -24,7 +24,7 @@ Mutation:
expression: this.getFieldName() == this.getFieldName()
message: "child"
type: Boolean
resolve: "@=mut('mutation_mock', args, validator)"
resolve: "@=m('mutation_mock', args, validator)"
args:
username:
type: String!
Expand All @@ -36,7 +36,7 @@ Mutation:

linkedConstraintsValidation:
type: Boolean
resolve: "@=mut('mutation_mock', args, validator)"
resolve: "@=m('mutation_mock', args, validator)"
validation:
link: Overblog\GraphQLBundle\Tests\Functional\Validator\DummyEntity
constraints:
Expand All @@ -54,7 +54,7 @@ Mutation:

collectionValidation:
type: Boolean
resolve: "@=mut('mutation_mock', args, validator)"
resolve: "@=m('mutation_mock', args, validator)"
args:
addresses:
type: "[Address]!"
Expand All @@ -70,7 +70,7 @@ Mutation:

cascadeValidationWithGroups:
type: Boolean
resolve: '@=mut("mutation_mock", args, validator)'
resolve: '@=m("mutation_mock", args, validator)'
args:
groups:
type: "[String]!"
Expand All @@ -85,7 +85,7 @@ Mutation:

userPasswordValidation:
type: Boolean
resolve: '@=mut("mutation_mock", args, validator)'
resolve: '@=m("mutation_mock", args, validator)'
args:
oldPassword:
type: "String"
Expand All @@ -94,7 +94,7 @@ Mutation:

expressionVariablesValidation:
type: Boolean
resolve: '@=mut("mutation_mock", args, validator)'
resolve: '@=m("mutation_mock", args, validator)'
args:
username:
type: "String"
Expand All @@ -103,7 +103,7 @@ Mutation:

autoValidationAutoThrow:
type: Boolean
resolve: '@=mut("mutation_mock", args)'
resolve: '@=m("mutation_mock", args)'
args:
username:
type: String!
Expand All @@ -115,7 +115,7 @@ Mutation:

autoValidationNoThrow:
type: Boolean
resolve: '@=mut("mutation_errors", errors)'
resolve: '@=m("mutation_errors", errors)'
args:
username:
type: String!
Expand All @@ -127,7 +127,7 @@ Mutation:

autoValidationAutoThrowWithGroups:
type: Boolean
resolve: '@=mut("mutation_mock", args)'
resolve: '@=m("mutation_mock", args)'
validationGroups: ["Default", "Address", "Period", "group1", "group2"]
args:
address:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Mutation:
fields:
noValidationDefined:
type: Boolean
resolve: '@=mut("mutation_mock", args, validator)'
resolve: '@=m("mutation_mock", args, validator)'
args:
username:
type: "String"