Services/DocumentService.php
changeset 80 cf6a88559482
parent 78 130e95ca5049
--- a/Services/DocumentService.php	Mon Feb 27 11:45:38 2012 +0100
+++ b/Services/DocumentService.php	Thu Mar 01 18:43:05 2012 +0100
@@ -66,13 +66,13 @@
         $src_doc = $doc_rep->findOneByExternalId($id_doc_src);
         if(is_null($src_doc))
         {
-            throw new Exception("cloneTags: no source doc");
+            throw new \Exception("cloneTags: no source doc");
         }
         
         $tgt_doc = $doc_rep->findOneByExternalId($id_doc_tgt);
         if(is_null($tgt_doc))
         {
-            throw new Exception("cloneTags: no target doc");
+            throw new \Exception("cloneTags: no target doc");
         }
         
         
@@ -92,6 +92,9 @@
      */
     public function addTags($doc, $tag_labels)
     {
+        if(is_null($tag_labels) || (!is_string($tag_labels) && !is_array($tag_labels)) ) {
+            return;
+        }
         // We get the DocumentTags
         $em = $this->getDoctrine()->getEntityManager();