1

Hi there i would like to create entities by console but give me an error i can't solve.

I've reading a lot about this error but i can't fix it.

1.-

php bin/console generate:bundle

2.-

php bin/console doctrine:mapping:convert xml ./src/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force

3.-

php bin/console doctrine:mapping:import BlogBundle yml

4.-

php bin/console doctrine:generate:entities BlogBundle

And the error is on 4th step:

C:\x\x\x\x\projecte>php bin/console doctrine:generate:entities BlogBundle:User


  [Doctrine\ORM\ORMException]
  Unknown Entity namespace alias 'BlogBundle'.


doctrine:generate:entities [--path PATH] [--no-backup] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <name>

PD: i'm using symfony 3.3

2 Answers 2

1

I use this commands to generate entities:

  1. php bin/console doctrine:mapping:import --force AppBundle --env=local --em=myentityManager
  2. php bin/console doctrine:mapping:convert annotation ./src --env=local --em=entityManager
  3. Delete orm.xml Files generated
  4. php bin/console doctrine:generate:entities AppBundle:User --env=local
Sign up to request clarification or add additional context in comments.

Comments

0

By Symfony conventions, the BlogBundle namespace goes under your company or project name (e.g. Acme\BlogBundle). So your BlogBundle should be prefixed with the company name like this:

C:\x\x\x\x\projecte>php bin/console doctrine:generate:entities AcmeBlogBundle:User

Just replace Acme with whatever subfolder your BlogBundle lives under and it should work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.