H
H
HellWalk2019-08-23 17:42:07
symfony
HellWalk, 2019-08-23 17:42:07

How to generate migrations on entity outside src/Entity?

Usually, entities are located in src/Entity, and when executing the command:
php bin/console make:migration
Symphony analyzes entities and generates migrations based on them.
My entities are in:
src/Models/User/Entity
and the symphony does not see them. What should be done?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2019-08-23
@HellWalk

You need to add mapping in /config/doctrine.yml settings (well, or in the file where these settings are):
For version 4: https://github.com/symfony/demo/blob/master/config...

doctrine:
     orm:
            mappings:
                  UserEntities:
                       type: annotation
                       dir: "%kernel.root_dir%/../src/Models/User/Entity"
                       is_bundle: false
                       prefix: <YOUR_NAMESPACE>\Models\User\Entity

U
user49981, 2019-08-23
@user49981

in doctrine.yml

doctrine:
    	orm:
            mappings:
                	dir: '%kernel.project_dir%/src/Models/User/Entity'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question