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

[GraphQL] Custom types #2492

Merged
merged 1 commit into from
Feb 11, 2019
Merged

Conversation

alanpoulain
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? yes?
Tests pass? yes
Fixed tickets
License MIT
Doc PR

Add a TypeInterface to register automatically custom types in GraphQL.
The IterableType has been modified to be used this way.
A TypesFactory service has been added, along with its interface to allow to register custom types any way you want.
Should we add a deprecation (see my comment below)?

$this->graphqlTypes['Iterable'] = new IterableType();
if ($this->typesFactory) {
$this->graphqlTypes += $this->typesFactory->getTypes();
} else {
Copy link
Member Author

Choose a reason for hiding this comment

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

Should we remove this else or add a deprecation?

Copy link
Member

Choose a reason for hiding this comment

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

IIRC this is still marked as Experimental no? I'd just keep the l81.

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 was asking this because of @dunglas's comment: #2447 (comment)

@alanpoulain
Copy link
Member Author

@lukasluecke WDYT of this PR?

Copy link
Contributor

@lukasluecke lukasluecke left a comment

Choose a reason for hiding this comment

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

LGTM 👍

$tag['id'] = $serviceId;
}

$types[$tag['id']] = new Reference($serviceId);
Copy link
Member

@soyuka soyuka Feb 6, 2019

Choose a reason for hiding this comment

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

Remove the isset line 37-39

Suggested change
$types[$tag['id']] = new Reference($serviceId);
$types[$tag['id'] ?? $serviceId] = new Reference($serviceId);

@alanpoulain
Copy link
Member Author

@soyuka do you think we could merge this one?

@soyuka
Copy link
Member

soyuka commented Feb 8, 2019

Can't merge because of travis :|

@soyuka soyuka merged commit 2bb6f95 into api-platform:master Feb 11, 2019
@soyuka
Copy link
Member

soyuka commented Feb 11, 2019

Thanks @alanpoulain !

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

Successfully merging this pull request may close these issues.

None yet

3 participants