equal
deleted
inserted
replaced
183 { |
183 { |
184 $this->getEntityManager()->remove($baseDocument); |
184 $this->getEntityManager()->remove($baseDocument); |
185 } |
185 } |
186 } |
186 } |
187 |
187 |
|
188 function getTagsStr($document) |
|
189 { |
|
190 $em = $this->getEntityManager(); |
|
191 $query = $em->createQuery("SELECT t.label FROM WikiTagBundle:DocumentTag dt JOIN dt.tag t WHERE dt.document = :docid"); |
|
192 $query = $query->setParameter("docid", $document); |
|
193 $result = $query->getScalarResult(); |
|
194 $tagstr = array(); |
|
195 foreach ($result as $res) { |
|
196 $tagstr[] = $res['label']; |
|
197 } |
|
198 return $tagstr; |
|
199 } |
|
200 |
188 function updateTagsStr($document) |
201 function updateTagsStr($document) |
189 { |
202 { |
190 $tags_str = array(); |
203 |
191 foreach($document->getTags() as $tag) |
204 $tagstr = $this->getTagsStr($document); |
192 { |
205 |
193 $tags_str[] = $tag->getTag()->getLabel(); |
206 $document->setTagsStr(implode(",",$tagstr)); |
194 } |
207 $this->getEntityManager()->persist($document); |
195 |
|
196 $document->setTagsStr(implode(",",$tags_str)); |
|
197 |
|
198 $this->getEntityManager()->flush(); |
|
199 } |
208 } |
200 |
209 |
201 } |
210 } |