Can't change environment type in Bundles.php
I have two different development environments (dev/dev_api) and when I change the environment in config/bundles.php and in package yaml file I got this error below:
CODE:
bundles.php
return [ Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev_api' => true, 'test' => true], ];
zenstruck_foundry.yaml
when@dev: &dev_api zenstruck_foundry: auto_refresh_proxies: true when@test: *dev_api
Error:
Version : "zenstruck/foundry": "^1.34" Any help please ?
hello,
shouldn't it be like this?
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'dev_api' => true, 'test' => true]
Hi ! I tried it, same error shown
please provide more information:
- full
zenstruck_foundry.yamlfile - in which environment are you working?
please provide more information:
- full
zenstruck_foundry.yamlfile - in which environment are you working?
zenstruck_foundry.yaml
Env: Symfony: 5.4 Docker version 20.10.21, build 20.10.21-0ubuntu1~20.04.2
seems something is missing:
when@dev_api: *dev
but the problem does not come from here I think
when I was talking about which environment I was meaning dev|test|prod|dev_api :sweat_smile:
please also could you provide a full stacktrace? (add -v option to the command which creates the problem)
sorry about mis-understanding, I'm working on dev_api environment.
stack strace:
I want to change the environment type inside the bundle instead of changing it for the whole project, I tried to change it in .env to "dev" and it worked, I'm creating factories successfully but if I want to do it the other way around it doesn't work.
I want to change the environment type inside the bundle instead of changing it for the whole project
not sure what you mean here? why do you want to achieve this? the environment is set for the whole app, not at bundle's level.
the error is weird: it seems the app does not load Foundry's config :thinking:
I just want the bundle to work in the dev_api environment, somewhow at the bundle's level, it's not getting the dev_api environment, it's getting dev
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'test' => true],
and I got the error when I change it to :
Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'dev_api' => true,'test' => true],
Did you get what I mean ?
yes, but it really not sounds like a Foundry problem: the bundle is agnostic of the app's environment.
maybe it would help if you can create a public reproducerr