Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add table prefix when I use doctrine:fixtures:load #293

Open
emass293 opened this issue Aug 27, 2019 · 1 comment
Open

How to add table prefix when I use doctrine:fixtures:load #293

emass293 opened this issue Aug 27, 2019 · 1 comment

Comments

@emass293
Copy link

emass293 commented Aug 27, 2019

I have a service like

 App\Doctrine\TableSchema:
        arguments:
            $prefix: '%env(string:DATABASE_PREFIX)%'
        tags:
            - { name: doctrine.event_subscriber, connection: default }

This service works well width the command 'doctrine:schema:create'

@gubler
Copy link

gubler commented Mar 8, 2022

This is a problem I am running into as well. But weirdly, with only a single entity (my user entity). All other entities are working fine. And using the same process in another application the prefix works fine with all of my Entities.

When I use the example from the Doctrine cookbook for adding table prefixes (https://www.doctrine-project.org/projects/doctrine-orm/en/2.11/cookbook/sql-table-prefixes.html) and I go to my site I can see in the Symfony debug bar that the prefix is used by Doctrine for my User entity.

However, when I try to load fixtures (via doctrine:fixtures:load) the prefix is not used (for either persisting or for reading from the database). Essentially, the loadMetaData event is not getting emitted for only my User entity, and only when using fixtures.

Its not a caching issue because I just got a new computer and this problem existed on the old computer and now the new one after a fresh install of the code and composer install.

I am sure this is something weird that I've done, but I can't find where. Nothing I can see is different with the User entity vs. other entities that are getting the prefix added. Any ideas where I should look to find out what is going wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants