liip / liip/LiipFunctionalTestBundle

ORMPurger::PURGE_MODE_TRUNCATE tries to find tables in wrong database in case of multiple databases and if bundles are shared between multiple entity manager.

Open
#108 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug move-to-fixtures-repository
Dominant language
PHP
Stars
648
Forks
179
PR merge metrics
No merged PRs in 30d

Description

Hi,
I have config something like below, to use AcmeUsersBundle entities in AcmeDemoBundle I have added AcmeUsersBundle under default.

        default:
            connection: default
            mappings:
              AcmeDemoBundle : ~
              AcmeUsersBundle : ~
        users:
            connection: ownership
            mappings:
            AcmeUsersBundle : ~

this->loadFixtures($classes, null, 'doctrine', ORMPurger::PURGE_MODE_TRUNCATE);

Tests tries to find Users database tables under default database as entities are shared, and truncate fails.

Also in case of cross database join, I had to use database name in mapping yml, e.g.

in Users.orm.yml

table: users.profile , it is with db name, so it will truncate Production database and not users_testing.profile.

What could be the solution ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the ORMPurger path invoked through loadFixtures(..., 'doctrine', ORMPurger::PURGE_MODE_TRUNCATE), using the shared AcmeUsersBundle mappings and multiple entity managers described in the issue. Check that table discovery and truncation use the entity manager's database, including mappings such as users.profile, and verify that the correct test database is affected rather than the production database.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
databases, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.