'How to change root namespace for Symfony 4 maker bundle?
I'm trying to change the default App namespace to AppBundle (the project uses S4, but the directory structure is still 3.4, currently) for Symfony 4 MakerBundle as instructed here: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html#configuration. It states I need to create a file in config/packages/dev/maker.yaml, but it does not specify what that is relative to? I've tried /app/config/packages/dev/maker.yaml, /config/packages/dev/maker.yaml, /src/AppBundle/Resources/config/packages/dev/maker.yaml, but it seems to just ignore any of those and try to create it in App. I've followed the format of the documentation:
# config/packages/dev/maker.yaml
# create this file if you need to configure anything
maker:
# tell MakerBundle that all of your classes lives in an
# Acme namespace, instead of the default App
# (e.g. Acme\Entity\Article, Acme\Command\MyCommand, etc)
root_namespace: 'AppBundle'
Solution 1:[1]
I faced the same issue, I am using 3.4 and found you have to place the maker config in
app/config/config_dev.yml
for it to work. I also had to modify my doctrine.yml orm mapping for the entity manager like so:
mappings:
AppBundle:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/AppBundle/Entity'
prefix: 'AppBundle\Entity'
alias: AppBundle
Solution 2:[2]
You have to clear the cache after you've created the configuration.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Jon |
Solution 2 | user6250909 |