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

[Major release] Symfony 7. GraphQLite 8 #229

Merged
merged 33 commits into from
Jan 3, 2025
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
730a640
chore: update deps
fogrye Mar 28, 2024
c6fdb1a
fix: replace ClassNameMapper with Finder
fogrye Mar 28, 2024
830af6a
fix: namespace should not end with \
fogrye Mar 28, 2024
574677e
rm fork
fogrye Mar 28, 2024
523f267
Update composer.json
fogrye Mar 29, 2024
2965602
fix: typing
fogrye Mar 29, 2024
5a05d3a
fix: assertion
fogrye Mar 29, 2024
d9e86ce
chore: correct validator version
fogrye Apr 13, 2024
f00dd6c
chore: bump php version to satisfy symfony packages
fogrye May 4, 2024
f6aac0e
fix(ci): bump ci php version
fogrye May 5, 2024
10e191f
:package: Make it compatible with PHP 8.1+ again - bundle is compatib…
andrew-demb Nov 16, 2024
8d0a0da
:package: Don't use Doctrine annotation for Symfony Validator - in v7…
andrew-demb Nov 16, 2024
c21cfdf
:package: Rework bundle structure according to the latest Symfony rec…
andrew-demb Nov 16, 2024
3d4c71a
:package: Fix compatibility with graphqlite v7
andrew-demb Nov 16, 2024
77f48c1
:package: Use `dev-master` for graphqlite because of improved perform…
andrew-demb Nov 16, 2024
75ea338
:package: Don't use deprecated method from `graphqlite`
andrew-demb Nov 16, 2024
818ff34
:package: Migrate to attributes - since support for Doctrine annotati…
andrew-demb Nov 16, 2024
7f720ae
:sparkles: Use service locator for `AggregateControllerQueryProviderF…
andrew-demb Nov 16, 2024
6b90bd4
:package: Improve readability
andrew-demb Nov 16, 2024
30dce85
:fire: Drop useless assert
andrew-demb Nov 16, 2024
06f4664
:rotating_light: Apply workaround for cache-related issue in tests
andrew-demb Nov 17, 2024
189589d
:package: Migrate to attributes - since support for Doctrine annotati…
andrew-demb Nov 17, 2024
a966ef1
:bug: Fix support for autowiring attribute in compiler pass - it is n…
andrew-demb Nov 17, 2024
d608925
:package: Fix phpstan command after reworking directory structure
andrew-demb Nov 17, 2024
c84f922
:fire: Drop bad class from test suite - this feature (ignoring psr-4 …
andrew-demb Nov 17, 2024
482fbe0
:poop: Use own `graphqlite` fork with applied fixes to show that CI i…
andrew-demb Nov 18, 2024
8c48367
:package: Switch back to the `dev-master` for origin `graphqlite` - r…
andrew-demb Nov 27, 2024
67d2b07
:package: Use stable graphqlite (v8). Use dev version of graphqlite v…
andrew-demb Dec 18, 2024
d158328
:package: Avoid deprecated
andrew-demb Dec 18, 2024
90ef14c
:fire: Doctrine annotations is not supported since GraphQLite 7 - dro…
andrew-demb Dec 18, 2024
25b690c
:package: Declare properties before methods. Add typing. Drop useless…
andrew-demb Dec 18, 2024
de1eb05
Merge branch 'master' into symfony-7
andrew-demb Dec 31, 2024
ae4511a
:package: Switch to original and stable version of validator-bridge
andrew-demb Jan 3, 2025
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
Prev Previous commit
Next Next commit
🐛 Fix support for autowiring attribute in compiler pass - it is now t…
…argeted to the method
andrew-demb committed Dec 18, 2024
commit a966ef1954e806be9bcc16336146f9a7be532089
36 changes: 16 additions & 20 deletions src/DependencyInjection/GraphQLiteCompilerPass.php
Original file line number Diff line number Diff line change
@@ -377,33 +377,29 @@ private function makePublicInjectedServices(ReflectionClass $refClass, Annotatio
*/
private function getListOfInjectedServices(ReflectionMethod $method, ContainerBuilder $container): array
{
/** @var array<string, string> $services */
$services = [];

/**
* @var Autowire[] $autowireAnnotations
*/
$autowireAnnotations = $this->getAnnotationReader()->getMethodAnnotations($method, Autowire::class);

$parametersByName = null;

foreach ($autowireAnnotations as $autowire) {
$target = $autowire->getTarget();

if ($parametersByName === null) {
$parametersByName = self::getParametersByName($method);
}
$annotations = $this->getAnnotationReader()->getParameterAnnotationsPerParameter($method->getParameters());
foreach ($annotations as $parameterName => $parameterAnnotations) {
$parameterAutowireAnnotation = $parameterAnnotations->getAnnotationsByType(Autowire::class);
foreach ($parameterAutowireAnnotation as $autowire) {
$id = $autowire->getIdentifier();
if ($id !== null) {
$services[$id] = $id;
continue;
}

if (!isset($parametersByName[$target])) {
throw new GraphQLException('In method '.$method->getDeclaringClass()->getName().'::'.$method->getName().', the @Autowire annotation refers to a non existing parameter named "'.$target.'"');
}
$parametersByName ??= self::getParametersByName($method);
if (!isset($parametersByName[$parameterName])) {
throw new \LogicException('Should not happen');
}

$id = $autowire->getIdentifier();
if ($id !== null) {
$services[$id] = $id;
} else {
$parameter = $parametersByName[$target];
$parameter = $parametersByName[$parameterName];
$type = $parameter->getType();
if ($type !== null && $type instanceof ReflectionNamedType) {
if ($type instanceof ReflectionNamedType) {
$fqcn = $type->getName();
if ($container->has($fqcn)) {
$services[$fqcn] = $fqcn;
1 change: 1 addition & 0 deletions tests/Fixtures/Entities/Contact.php
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ public function injectService(
if (!$testService instanceof TestGraphqlController || $someService === null || $someAlias === null) {
return 'KO';
}

return 'OK';
}