From fc031e5706acf89ff21f22ca8004ddc7f9b43089 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 27 Dec 2015 22:26:49 +0100 Subject: Avoid multiple tag creation When a new tag is created but not yet persisted, it can be duplicated. It could happen when multiple rules match the content and at least 2 of them should attach same new tag. Fix #1528 --- .../DataFixtures/ORM/LoadTaggingRuleData.php | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php (limited to 'src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php') diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php new file mode 100644 index 00000000..09a08bb2 --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadTaggingRuleData.php @@ -0,0 +1,41 @@ +setRule('content matches "spurs"'); + $tr1->setTags(array('sport')); + $tr1->setConfig($this->getReference('admin-config')); + + $manager->persist($tr1); + + $tr2 = new TaggingRule(); + $tr2->setRule('content matches "basket"'); + $tr2->setTags(array('sport')); + $tr2->setConfig($this->getReference('admin-config')); + + $manager->persist($tr2); + + $manager->flush(); + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 40; + } +} -- cgit v1.2.3