I have a Symfony2 project with its own database, and now I want to connect to another database (another project) so I can modify some tables.
I created the new conne
You have to update the getTablePrimaryKeys function to:
private function getTablePrimaryKeys(Table $table)
{
try {
$primaryKeyColumns = ($this->tables[$table->getName()]->hasPrimaryKey())?$this->tables[$table->getName()]->getPrimaryKey()->getColumns():array();
} catch(SchemaException $e) {
$primaryKeyColumns = array();
}
return array();
}
Note that --filter
in your command should be populated with the Entity Class name and not the Table name. If the entity does not yet exists, the Entity Class name must compliment your table name. So if your table is user_table
, the filter value would be UserTable
.
And then to work around that your DB has some tables that Doctrine cannot handle, you should whitelist the tables you do want allow Doctrine to manage. You can do this in your config file like, so:
doctrine:
dbal:
# ...
schema_filter: /^(users_table|emails)$/
alternatively you can specify this in your cli-config.php file.
/** @var Doctrine\ORM\Configuration $config */
$config->setFilterSchemaAssetsExpression('/^(users_table|email)$/');