Ignore duplicates when using INSERT in a Database with Symfony and Doctrine
问题 I have a table CREATE TABLE `sob_tags_articles` ( `tag_id` int(11) NOT NULL, `article_id` int(11) NOT NULL, `id` int(11) NOT NULL auto_increment, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=112 And triing to save an object with Doctrine: $sbTagsArticles = new SobTagsArticles(); $sbTagsArticles->article_id = $pubId; $sbTagsArticles->tag_id = $tagId; $sbTagsArticles->save(); But if record exists with the same $pubId and $tagId new record will be insertet with new PK. How to do INSERT