Entity/DocumentRepository.php
changeset 63 774ba82dca59
parent 57 186c4121c7b3
child 65 ba6b8e38d90e
equal deleted inserted replaced
62:10be6b9e55e7 63:774ba82dca59
   241      * @return array
   241      * @return array
   242      */
   242      */
   243     public function getTagsStr($document)
   243     public function getTagsStr($document)
   244     {
   244     {
   245         $em = $this->getEntityManager();
   245         $em = $this->getEntityManager();
   246         $query = $em->createQuery("SELECT t.label FROM WikiTagBundle:DocumentTag dt JOIN dt.tag t WHERE dt.document = :docid");
   246         $query = $em->createQuery("SELECT t.label FROM WikiTagBundle:DocumentTag dt JOIN dt.tag t WHERE dt.document = :docid ORDER BY dt.tagOrder");
   247         $query = $query->setParameter("docid", $document);
   247         $query = $query->setParameter("docid", $document);
   248         $result = $query->getScalarResult();
   248         $result = $query->getScalarResult();
   249         $tagstr = array();
   249         $tagstr = array();
   250         foreach ($result as $res) {
   250         foreach ($result as $res) {
   251             $tagstr[] = $res['label'];
   251             $tagstr[] = $res['label'];
   252         }
   252         }
   253         return $tagstr;
   253         return $tagstr;
   254     }
   254     }
       
   255     
   255     
   256     
   256     /**
   257     /**
   257      * Update a wikitag document tags string.
   258      * Update a wikitag document tags string.
   258      * @param DocumentInterface $document the wikitag document
   259      * @param DocumentInterface $document the wikitag document
   259      */
   260      */