equal
deleted
inserted
replaced
363 |
363 |
364 $res = $query->getResult(); |
364 $res = $query->getResult(); |
365 |
365 |
366 return $res; |
366 return $res; |
367 } |
367 } |
|
368 |
|
369 /** |
|
370 * Copy the tahg lst from one document instance to another |
|
371 * @param IRI\Bundle\WikitagBundle\Model\DocumentInterface $src_doc |
|
372 * @param IRI\Bundle\WikitagBundle\Model\DocumentInterface $tgt_doc |
|
373 */ |
|
374 public function copyTags($src_doc, $tgt_doc) |
|
375 { |
|
376 //remove the previous tags |
|
377 foreach ($tgt_doc->getTags() as $doctag) { |
|
378 $this->getEntityManager()->remove($doctag); |
|
379 } |
|
380 |
|
381 // add the new ones |
|
382 foreach ($src_doc->getTags() as $doctag) { |
|
383 $new_doctag = clone $doctag; |
|
384 $new_doctag->setDocument($tgt_doc); |
|
385 $this->getEntityManager()->persist($new_doctag); |
|
386 } |
|
387 |
|
388 $tgt_doc->setManualOrder(false); |
|
389 $this->getEntityManager()->persist($tgt_doc); |
|
390 } |
368 |
391 |
369 } |
392 } |