1

I am new to doctrine so please be patient.

When I am trying to run vendor/bin/doctrine orm:schema-tool:drop --force I am getting the following error message:

Unknown database type enum requested, Doctrine\DBAL\Platforms\MySQL57Platform may not support it.

Yeah, yeah, yeah, I know, I've read tons of topics about this, like this one.

My problem is, I want it to do in my bootstrap.php for cli-config.php as in the documentation.

Here is my code:

    $isDevMode = true;
    $paths = [APP_DIR . 'classes/Entities'];
    $dbParams = [
        'driver'        => 'pdo_mysql',
        'user'          => Config::DB_USER,
        'password'      => Config::DB_PASSWORD,
        'dbname'        => Config::DB_DATABASE
    ];
    $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
    return \Doctrine\ORM\EntityManager::create($dbParams, $config);

I've tried to add this line to the params:

'mapping_types' => ['enum' => 'string']

but the documentation clearly says what options can be in the params.

I can not change the database. This is not a symfony project.

Does anybody has an idea?

vaso123
  • 12,347
  • 4
  • 34
  • 64

1 Answers1

0

Ok, this could be a solution.

Based on this post I've altered my code like this:

...
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);

$entityManager = \Doctrine\ORM\EntityManager::create($dbParams, $config);
$conn = $entityManager->getConnection();
$sqlSchemaManager = new SQLServerSchemaManager($conn);
$sqlSchemaManager->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
return $entityManager;
vaso123
  • 12,347
  • 4
  • 34
  • 64