equal
deleted
inserted
replaced
64 $doc_rep = $em->getRepository("WikiTagBundle:Document"); |
64 $doc_rep = $em->getRepository("WikiTagBundle:Document"); |
65 |
65 |
66 $src_doc = $doc_rep->findOneByExternalId($id_doc_src); |
66 $src_doc = $doc_rep->findOneByExternalId($id_doc_src); |
67 if(is_null($src_doc)) |
67 if(is_null($src_doc)) |
68 { |
68 { |
69 throw new Exception("cloneTags: no source doc"); |
69 throw new \Exception("cloneTags: no source doc"); |
70 } |
70 } |
71 |
71 |
72 $tgt_doc = $doc_rep->findOneByExternalId($id_doc_tgt); |
72 $tgt_doc = $doc_rep->findOneByExternalId($id_doc_tgt); |
73 if(is_null($tgt_doc)) |
73 if(is_null($tgt_doc)) |
74 { |
74 { |
75 throw new Exception("cloneTags: no target doc"); |
75 throw new \Exception("cloneTags: no target doc"); |
76 } |
76 } |
77 |
77 |
78 |
78 |
79 $doc_rep->copyTags($src_doc, $tgt_doc); |
79 $doc_rep->copyTags($src_doc, $tgt_doc); |
80 |
80 |
90 * @param mixed $doc the document to add the tags to |
90 * @param mixed $doc the document to add the tags to |
91 * @param string|array $tag_label : the label of the new tag |
91 * @param string|array $tag_label : the label of the new tag |
92 */ |
92 */ |
93 public function addTags($doc, $tag_labels) |
93 public function addTags($doc, $tag_labels) |
94 { |
94 { |
|
95 if(is_null($tag_labels) || (!is_string($tag_labels) && !is_array($tag_labels)) ) { |
|
96 return; |
|
97 } |
95 // We get the DocumentTags |
98 // We get the DocumentTags |
96 $em = $this->getDoctrine()->getEntityManager(); |
99 $em = $this->getDoctrine()->getEntityManager(); |
97 |
100 |
98 $class = $this->getContainer()->getParameter("wiki_tag.document_class"); |
101 $class = $this->getContainer()->getParameter("wiki_tag.document_class"); |
99 |
102 |