Skip to content

Commit 64cd7ae

Browse files
committed
Making autowired services in prefetch method public in the container
1 parent b05eed0 commit 64cd7ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

DependencyInjection/GraphqliteCompilerPass.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,16 @@ private function makePublicInjectedServices(ReflectionClass $refClass, Annotatio
291291
{
292292
$services = $this->getCodeCache()->get($refClass, function() use ($refClass, $reader, $container, $isController) {
293293
$services = [];
294-
foreach ($refClass->getMethods() as $method) {
294+
foreach ($refClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
295295
$field = $reader->getRequestAnnotation($method, AbstractRequest::class);
296296
if ($field !== null) {
297297
if ($isController) {
298298
$services[$refClass->getName()] = $refClass->getName();
299299
}
300300
$services += $this->getListOfInjectedServices($method, $container);
301+
if ($field instanceof Field && $field->getPrefetchMethod() !== null) {
302+
$services += $this->getListOfInjectedServices($refClass->getMethod($field->getPrefetchMethod()), $container);
303+
}
301304
}
302305
}
303306
return $services;

0 commit comments

Comments
 (0)