Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't change environment type in Bundles.php #481

Closed
ashraf-96 opened this issue Jul 17, 2023 · 11 comments
Closed

Can't change environment type in Bundles.php #481

ashraf-96 opened this issue Jul 17, 2023 · 11 comments

Comments

@ashraf-96
Copy link

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:
image

Version :
"zenstruck/foundry": "^1.34"
Any help please ?

@nikophil
Copy link
Member

hello,

shouldn't it be like this?

Zenstruck\Foundry\ZenstruckFoundryBundle::class => ['dev' => true, 'dev_api' => true, 'test' => true]

@ashraf-96
Copy link
Author

Hi !
I tried it, same error shown

@nikophil
Copy link
Member

please provide more information:

  • full zenstruck_foundry.yaml file
  • in which environment are you working?

1 similar comment
@nikophil
Copy link
Member

please provide more information:

  • full zenstruck_foundry.yaml file
  • in which environment are you working?

@ashraf-96
Copy link
Author

ashraf-96 commented Jul 17, 2023

zenstruck_foundry.yaml

image

Env:
Symfony: 5.4
Docker version 20.10.21, build 20.10.21-0ubuntu1~20.04.2

@nikophil
Copy link
Member

nikophil commented Jul 17, 2023

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 😅

please also could you provide a full stacktrace? (add -v option to the command which creates the problem)

@ashraf-96
Copy link
Author

sorry about mis-understanding, I'm working on dev_api environment.
stack strace:
image

@ashraf-96
Copy link
Author

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.

@nikophil
Copy link
Member

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 🤔

@ashraf-96
Copy link
Author

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 ?

@nikophil
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants