diff -r caeb4c8b5487 -r ba6b8e38d90e Entity/TagRepository.php --- a/Entity/TagRepository.php Wed Dec 14 23:53:37 2011 +0100 +++ b/Entity/TagRepository.php Mon Dec 19 17:50:04 2011 +0100 @@ -31,7 +31,7 @@ public function getCompletion($seed) { $qb = $this->getEntityManager()->createQueryBuilder(); - $qb->select('t.label'); + $qb->select('DISTINCT t.label'); $qb->from('WikiTagBundle:Tag','t'); $qb->where($qb->expr()->orx( $qb->expr()->like('t.label',$qb->expr()->literal(addcslashes(mysql_real_escape_string($seed),"%_")."%")), @@ -56,6 +56,7 @@ $tag_label_normalized = WikiTagUtils::normalizeTag($tag_label); // We get the wikipedia references for the tag_label // We get or create the tag object + // TODO: search also in work unit ? $tags = $this->findBy(array('normalizedLabel' => $tag_label_normalized)); $tag = null; foreach ($tags as $t) { @@ -92,7 +93,6 @@ // Save datas. $em = $this->getEntityManager(); $em->persist($tag); - $em->flush(); $wikipedia_revision_id = $wp_response['revision_id'];