Hello everybody!
I'd like to use PHPUnit in ZF2 with Doctrine2. Therefore I want to create a
SQLite database from the Doctrine metadata using the Doctrine Schema Tool.
Unfortunately, I get the following error message:
PHP Fatal error: Uncaught exception 'Doctrine\DBAL\Schema\SchemaException'
with message 'The table with name 'db.sqlite.core_resource_privilege'
already exists.' in
/var/www/html/ic_web_framework/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php:109
Stack trace:
#0
/var/www/html/ic_web_framework/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php(132):
Doctrine\DBAL\Schema\SchemaException::tableAlreadyExists('db.sqlite.core_...')
#1
/var/www/html/ic_web_framework/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Schema.php(340):
Doctrine\DBAL\Schema\Schema->_addTable(Object(Doctrine\DBAL\Schema\Table))
#2
/var/www/html/ic_web_framework/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/SchemaTool.php(510):
Doctrine\DBAL\Schema\Schema->createTable('core_resource_p...')
#3
/var/www/html/ic_web_framework/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/SchemaTool.php(245):
Doctrine\ORM\Tools\SchemaTool->gatherRelationsSql(Object(Doctrine\ORM\Mapping\ClassMetadata),
Object(Doctrine\DBAL\Schema\Table), Object(Doctrine\DBAL\Sche in
/var/www/html/ic_web_framework/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/SchemaException.php
on line 109
This is my driver definition:
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOSqlite\Driver',
'params' => array(
'charset' => 'utf8',
'path' => 'db.sqlite',
'memory' => true,
)
)
)
),
);
My bootstrap.php looks like this:
$serviceManager = new ServiceManager(new ServiceManagerConfig());
$serviceManager->setService('ApplicationConfig', $config);
$serviceManager->get('ModuleManager')->loadModules();
static::$serviceManager = $serviceManager;
static::$config = $config;
$em=$serviceManager->get('doctrine.entitymanager.orm_default');
$tool= new SchemaTool($em);
if(!$em instanceof EntityManager){
}
$tool->dropSchema($em->getMetadataFactory()->getAllMetadata());
$tool->createSchema($em->getMetadataFactory()->getAllMetadata());
I would be very thankful for your help!
Greeting
Lukas Liebig
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.