# HG changeset patch # User cavaliet # Date 1330078990 -3600 # Node ID 130e95ca50497e3d7c3103796179e2a01fa64140 # Parent 021131fbe2c571695ce3bac8f1ff26ccae33cc72 correct call getMaxOrder diff -r 021131fbe2c5 -r 130e95ca5049 Services/DocumentService.php --- 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);