D
D
dake12312017-06-08 14:23:54
symfony
dake1231, 2017-06-08 14:23:54

How to properly generate a Symfony 3 entity?

Hello! Can't generate entity from DB in Symfony3.
Writing

$ php bin/console doctrine:mapping:import --force UsersBundle yml

I receive
Importing mapping information from "default" entity manager
  > writing C:\OpenServer\domains\qpt\src\UsersBundle/Resources/config/doctrine/"user".orm.yml


  [Symfony\Component\Debug\Exception\ContextErrorException]
  Warning: file_put_contents(C:\OpenServer\domains\qpt\src\UsersBundle/Resources/config/doctrine/"user".orm.yml): failed to open stream: No such file or directory


doctrine:mapping:import [--em [EM]] [--shard SHARD] [--filter FILTER] [--force] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <comman
d> <bundle> [<mapping-type>]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Shurman, 2017-06-19
@VaShu

I could be wrong, but the problem is probably "user".orm.yml. Windows didn't allow/couldn't create a file with that name (and the slashes are confused between Windows and Linux). On Ubuntu, I checked the situation with a demo example and everything seems to work:
1. I created a database from the existing entities:
bin/console doctrine:database:create
doctrine:schema:update --force
2. deleted the demo/src/AppBundle/Entity folder
3. further on the documentation (I have a base and want to generate an entity based on it)
symfony.com/doc/current/doctrine/reverse_engineeri...
a). php bin/console doctrine:mapping:import --force AppBundle yml
b). php bin/console doctrine:mapping:convert annotation ./src
c). php bin/console doctrine:generate:entities AppBundle

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question