Controller/WikiTagController.php
changeset 5 45378793512a
parent 2 13f43f53d0ba
child 7 7a877de630fd
--- a/Controller/WikiTagController.php	Mon Oct 17 17:17:14 2011 +0200
+++ b/Controller/WikiTagController.php	Tue Oct 18 10:32:30 2011 +0200
@@ -218,7 +218,7 @@
         $tag_label = $this->getRequest()->request->get('value');
         // We get the DocumentTags
         $em = $this->getDoctrine()->getEntityManager();
-        $tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findBy(array('document' => $id_doc));
+        $tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findByDocumentExternalId($id_doc);
         $nb_tags = count($tags);
         $found = false;
         $i = 0;
@@ -241,7 +241,7 @@
         $revision_id = $ar[1];
         $created = $ar[2];
 
-        $tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findBy(array('document' => $id_doc, 'tag'=>$tag->getId()));
+        $tags = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findByDocumentExternalId($id_doc, array('tag'=>$tag->getId()));
         $nb_tags = count($tags);
 
         if($created==true || $nb_tags==0){
@@ -251,8 +251,7 @@
             $new_order = intval(reset($a1)) + 1;
             // TODO: use a factory that returns an DocumentTagInterface
             $new_DT = new DocumentTag();
-            //return new Response(var_dump($this->getDoctrine()->getRepository('WikiTagBundle:WikiTagDocument')->findOneBy(array('id' => $idDoc))));
-            $new_DT->setDocument($this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneBy(array('id' => $id_doc)));
+            $new_DT->setDocument($this->getDoctrine()->getRepository('WikiTagBundle:Document')->findOneByExternalId($id_doc));
             $new_DT->setTag($tag);
             $new_DT->setOriginalOrder($new_order);
             $new_DT->setTagOrder($new_order);
@@ -295,7 +294,8 @@
             $em->persist($un_tag);
         }
         // We associate the unsemantized tag to the DocumentTag and save datas
-        $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneBy(array('document' => $idDoc, 'tag' => $idTag));
+        // TODO: do the request on external id of document
+        $dt = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->findOneByDocumentExternalId($id_doc, array('tag' => $idTag));
         $dt->setTag($un_tag);
         $em->flush();
         
@@ -306,6 +306,7 @@
     /**
      *
      * TODO : Enter description here ...
+     * TODO : implement
      * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
      */
     public function updateTagAliasAction()