maker-bundle: 'Make:entity' failed when don't use the default namespace 'App'.
src/Doctrine/DoctrineEntityHelper.php
line 45
$entityClassDetails = new ClassNameDetails($metadata->name, 'App\\Entity');
src/Maker/MakeCommand.php
line 91
$generator = new Generator($this->fileManager, 'App\\');
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (9 by maintainers)
Commits related to this issue
- minor #171 Better message with full namespace (LeJeanbono) This PR was merged into the 1.0-dev branch. Discussion ---------- Better message with full namespace #133 Commits ------- 5e9104c Bette... — committed to symfony/maker-bundle by weaverryan 6 years ago
- feature #173 Add configuration of root namespace (Sergey Rabochiy, weaverryan) This PR was merged into the 1.0-dev branch. Discussion ---------- Add configuration of root namespace This PR adds co... — committed to symfony/maker-bundle by weaverryan 6 years ago
For People looking for answer:
It works! To clarify use config similar to this:
@upyx it was just a suggestion. 😄 Obviously configuration file would be the best option. To be honest I would be happy if we could even pass it in like other options
--namespace=\\MyAwesomeApp\\src( or something similar )Hmm, the command should work if you pass a fully-qualified class name to the first step - e.g.
Acme\Foo\Bar, but it looks like we missed at least one thing:Here’s the error I’m currently getting:
I’m getting the same error, having configured the default namespace. I’m using my own namespace under src/.
@helariL Hello! In my opinion we should use configuration file. There is part of
composer.jsonfrom symfony project:What is it the namespace to use as root? 😄
Hmm, this does help! What you’re describing is the expected behavior: we assume App unless you pass a full class name (including the beginning slash iirc). But, I think if we guess App, but we can’t determine where to generate the file (which means that you have no App namespace in your autoloading), we could THEN ask you to clarify by entering the full class name. Then you could easily know how to use the command in these cases 😃.