Currently, it is not possible to define service factory as call of magic method. It throws Factory 'Aws\Sdk::createSqs' used in service '237' is not callable. It's because this checks
|
try { |
|
$reflection = Nette\Utils\Callback::toReflection($entity[0] === '' ? $entity[1] : $entity); |
|
$refClass = $reflection instanceof \ReflectionMethod ? $reflection->getDeclaringClass() : NULL; |
|
} catch (\ReflectionException $e) { |
|
} |
|
|
|
if (isset($e) || ($refClass && (!$reflection->isPublic() |
|
|| ($refClass->isTrait() && !$reflection->isStatic()) |
|
))) { |
|
$name = array_slice(array_keys($recursive), -1); |
|
throw new ServiceCreationException(sprintf("Factory '%s' used in service '%s' is not callable.", Nette\Utils\Callback::toString($entity), $name[0])); |
|
} |
throws
ReflectionException: Method Aws\Sdk::createSqs() does not exist. See Sdk
class definition.
I would like to create client services for particular AWS services. It's much cleaner to inject client directly, than injecting Sdk and then creating a client in the class.
services:
- Aws\Sdk({
credentials: {
key: %aws.access%,
secret: %aws.secret%,
},
version: latest,
region: 'eu-west-1',
})
-
class: Aws\Sqs\SqsClient
factory: @Aws\Sdk::createSqs
Currently, it is not possible to define service factory as call of magic method. It throws
Factory 'Aws\Sdk::createSqs' used in service '237' is not callable.It's because this checksdi/src/DI/ContainerBuilder.php
Lines 473 to 484 in 514991b
ReflectionException: Method Aws\Sdk::createSqs() does not exist. See Sdk class definition.I would like to create client services for particular AWS services. It's much cleaner to inject client directly, than injecting Sdk and then creating a client in the class.