Closed Didixdan closed 5 days ago
For those who wants to have this to work, here is a temporary trait until Foundry work as we want.
namespace App\Traits;
use Doctrine\ODM\MongoDB\DocumentManager;
/**
* @method static bootKernel()
*/
trait ResetDatabaseODM
{
public function setUp(): void
{
static::bootKernel();
/** @var DocumentManager $documentManager */
$documentManager = static::$kernel->getContainer()->get('doctrine_mongodb.odm.document_manager');
$documentManager->getSchemaManager()->dropDatabases();
}
}
Hello,
you can list the connections/managers you want to reset, thanks to bundle configuration.
You can find an example in the docs here: https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#database-reset
wouldn't it fix your case to pass it an empty array?
closing stale issue
It seems like the Database Resetter does not work well when we have a ODM database and an ORM database.
When i write a functional test and i'm using ResetDatabase trait, the package call
DatabaseResetter::resetDatabase
which callcreateORMDatabaseResetter
and reset it.I know it does that because he attempt to create a test database, and got an access denied from the MySQL container (valid behavior because the functional test is only for ODM)
How can i tell Foundry to not reset the database of the ORM connection ? I've found nothing about that in all issues/PR.