I want to import a Doctrine mapping for a table called stores. I do:
./app/console doctrine:mapping:import MyBundle annotation --filter="stores"
I get the error:
[Doctrine\ORM\Mapping\MappingException]
Table Cat_map has no primary key. Doctrine does not support reverse engineering from tables that don't have a prima
ry key.
Am I using the filter incorrectly? I dont want doctrine to try and map any table other than 'stores'
Requested create syntax:
CREATE TABLE `stores` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`storeid` int(11) NOT NULL,
`store` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=96 DEFAULT CHARSET=utf8;
Despite the --filter attribute Doctrine analyse all the tables. If everything is OK then it go through the filter creating only the specified entity.
So, you should try to fix the cat_map table adding a primary key. If you're not figuring out a way or if you got particular needs, please update your question including the cat_map part.
I hope this helps!
Use something other than doctrine for existing databases. Doctrine hasn't fixed this issue for many years.
You can tell Doctrine to ignore tables that match a certain regex. For example, if you want to ignore tables that begin with "custom_", put this in your config.yml:
This seems to do the trick. For for information: http://symfony.com/doc/current/bundles/DoctrineMigrationsBundle/index.html#manual-tables