How to load a config with FrameworkConfig $framework from a bundle #42450
-
Hello How can I load from my bundle extension a config file who use Frameworkconfig return static function (FrameworkConfig $framework) {
$messenger = $framework->messenger();
$messenger
->transport('async', [
'dsn' => '%env(MESSENGER_TRANSPORT_DSN)%',
'options' => [
'auto_setup' => true,
'use_notify' => true,//PostgreSQL’s
'check_delayed_interval' => 60000,
],
'retry_strategy' => [
'max_retries' => 3,
'multiplier' => 2,
],
]);
$messenger->routing('Symfony\Component\Mailer\Messenger\SendEmailMessage')->senders(['async']);
}; From my extension class AcMarcheMercrediExtension extends Extension implements PrependExtensionInterface
{
public function load(array $configs, ContainerBuilder $containerBuilder): void
{
$phpFileLoader = new PhpFileLoader($containerBuilder, new FileLocator(__DIR__.'/../../config'));
$phpFileLoader->load('services.php');
$phpFileLoader->load('packages/messenger.php'); //doesn't work
} I have this error : Could not resolve argument "Symfony\Config\FrameworkConfig $framework" for "/var/www/appli/src/AcMarche/Mercredi/src/DependencyInjection/../../config/packages/messenger.php". |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
what's the previous exception? symfony/src/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php Lines 138 to 140 in e34cd7d |
Beta Was this translation helpful? Give feedback.
-
LogicException You can see my bundle here https://github.com/acmarche/mercredi/blob/master/src/DependencyInjection/AcMarcheMercrediExtension.php |
Beta Was this translation helpful? Give feedback.
LogicException
You cannot use the ConfigBuilders without providing a class implementing ConfigBuilderGeneratorInterface.
You can see my bundle here https://github.com/acmarche/mercredi/blob/master/src/DependencyInjection/AcMarcheMercrediExtension.php