Tom Downes
Tom Downes

Reputation: 61

doctrine:migrations:diff not detecting mapping information for an entity in a non-standard directory

I have generated an entity named 'MyEntity' with annotation type mapping information using the doctrine:mapping:convert command with the --from-database option.

The entity is in a non-satandard folder which is defined in the doctrine ORM configuration as:

doctrine:
  orm:
    entity_managers:
      default:
        MyEntity:
          mapping: true
          type: annotation
          dir: '%kernel.root_dir%/../src/Path/To/Entity'
          prefix: 'Path\To\Entity'
          is_bundle: false

The class appears in the appropriate directory and has all of the correct properties and annotations however when I try to use the doctrine:migrations:diff command the outcome is a migration that drops the table that the entity was generated from in the first place. This seems to imply that the mapping information generated by the doctrine:mapping:convert command is not being picked up by the doctrine:migrations:diff command. Any insight on this issue would br greatly appreciated.

Upvotes: 2

Views: 3279

Answers (1)

Tom Downes
Tom Downes

Reputation: 61

After returning to the problem I noticed that the generated entity class was in the global namespace as opposed to the one specified by the config file, correcting this immediately fixed the problem.

Upvotes: 4

Related Questions