--- a/Services/DocumentService.php Fri Feb 24 10:55:01 2012 +0100
+++ b/Services/DocumentService.php Fri Feb 24 11:23:10 2012 +0100
@@ -100,7 +100,7 @@
if(! is_a($doc,"\IRI\Bundle\WikiTagBundle\Model\DocumentInterface")) {
$doc_rep = $this->getDoctrine()->getRepository('WikiTagBundle:Document');
if(is_a($doc, $class)) {
- // todo: use reflection to get the id
+ // Get the document column id, set in the config file.
$doc_id = $doc_rep->reflectionGetField($doc, Container()->getParameter("wiki_tag.document_id_column"));
}
else {
@@ -162,10 +162,9 @@
$query->setParameters(array("id_doc"=>$doc, "tag"=>$tag));
$nb_tags = $query->getSingleScalarResult();
}
-
+
if($created || $nb_tags==0){
-
- $max_order = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->getMaxOrder($doc);
+ $max_order = $this->getDoctrine()->getRepository('WikiTagBundle:DocumentTag')->getMaxOrder($doc_id);
$new_order = $max_order + 1;
$new_DT = new DocumentTag();
$new_DT->setDocument($doc);