Skip to content

refactor(metadata): no default graphql operation name #5348

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

Closed
wants to merge 2 commits into from

Conversation

soyuka
Copy link
Member

@soyuka soyuka commented Jan 18, 2023

No description provided.

@@ -78,6 +78,7 @@ public function getItemQueryFields(string $resourceClass, Operation $operation,
return [];
}

// TODO: it'd be nice to get rid of this hard coded name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using instanceof here?


if (!$useWrappedType) {
$wrappedOperationName = $operation instanceof Query ? $operationName : 'item_query';
$wrappedOperation = $resourceMetadataCollection->getGraphQlOperation(null, forceCollection: $operation instanceof Query);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using a named argument here and not elsewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to start using them I can revert for the codestyle

Copy link
Member

@alanpoulain alanpoulain Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think it's better like this indeed. But you should uniformize the call.

->withClass($type->getClassName())
->withShortName($operation?->getShortName() ?? (new \ReflectionClass($type->getClassName()))->getShortName())
->withDescription($operation?->getDescription());
$enumOperation = new Query(name: 'item_query', class: $type->getClassName(), shortName: $operation?->getShortName() ?? (new \ReflectionClass($type->getClassName()))->getShortName(), description: $operation?->getDescription());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name is not necessary, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do need a name

@@ -115,7 +115,7 @@ class: $class,
fetchPartial: $fetchPartial,
forceEager: $forceEager,
priority: $priority,
name: $name ?: 'item_query',
name: $name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we want to remove logic from our operations

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, why not.

@stale
Copy link

stale bot commented Mar 21, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@soyuka
Copy link
Member Author

soyuka commented Jul 25, 2023

This is done in #5657

@soyuka soyuka closed this Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants