diff --git a/src/Kdyby/RabbitMq/DI/RabbitMqExtension.php b/src/Kdyby/RabbitMq/DI/RabbitMqExtension.php index 2a6cf5eb..f4103ed8 100644 --- a/src/Kdyby/RabbitMq/DI/RabbitMqExtension.php +++ b/src/Kdyby/RabbitMq/DI/RabbitMqExtension.php @@ -241,8 +241,13 @@ protected function loadConnections($connections) foreach ($connections as $name => $config) { $config = $this->mergeConfig($config, $this->connectionDefaults); - Nette\Utils\Validators::assertField($config, 'user', 'string:3..', "The config item '%' of connection {$this->name}.{$name}"); - Nette\Utils\Validators::assertField($config, 'password', 'string:3..', "The config item '%' of connection {$this->name}.{$name}"); + if (!$config['user'] instanceof Nette\DI\Statement) { + Nette\Utils\Validators::assertField($config, 'user', 'string:3..', "The config item '%' of connection {$this->name}.{$name}"); + } + + if (!$config['password'] instanceof Nette\DI\Statement) { + Nette\Utils\Validators::assertField($config, 'password', 'string:3..', "The config item '%' of connection {$this->name}.{$name}"); + } $connection = $builder->addDefinition($serviceName = $this->prefix($name . '.connection')) ->setClass('Kdyby\RabbitMq\Connection')