equal
deleted
inserted
replaced
8 * file that was distributed with this source code. |
8 * file that was distributed with this source code. |
9 */ |
9 */ |
10 |
10 |
11 namespace IRI\Bundle\WikiTagBundle\Command; |
11 namespace IRI\Bundle\WikiTagBundle\Command; |
12 |
12 |
|
13 use IRI\Bundle\WikiTagBundle\Event\WikiTagEvents; |
|
14 use IRI\Bundle\WikiTagBundle\Event\DocumentTagEvent; |
13 use Doctrine\ORM\Query; |
15 use Doctrine\ORM\Query; |
14 |
|
15 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
16 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
16 use Symfony\Component\Console\Input\InputArgument; |
17 use Symfony\Component\Console\Input\InputArgument; |
17 use Symfony\Component\Console\Input\InputInterface; |
18 use Symfony\Component\Console\Input\InputInterface; |
18 use Symfony\Component\Console\Input\InputOption; |
19 use Symfony\Component\Console\Input\InputOption; |
19 use Symfony\Component\Console\Output\OutputInterface; |
20 use Symfony\Component\Console\Output\OutputInterface; |
73 $memory = ((($done%10)==0)?" - mem: ".strval(memory_get_usage(true)):""); |
74 $memory = ((($done%10)==0)?" - mem: ".strval(memory_get_usage(true)):""); |
74 $doc = $row[0]; |
75 $doc = $row[0]; |
75 $todetach[] = $doc; |
76 $todetach[] = $doc; |
76 $output->writeln("Process doc id ".$doc->getId()." $done/$total ".strval(intval(floatval($done)/floatval($total)*100.0))."%$memory"); |
77 $output->writeln("Process doc id ".$doc->getId()." $done/$total ".strval(intval(floatval($done)/floatval($total)*100.0))."%$memory"); |
77 $docrep->updateTagsStr($doc); |
78 $docrep->updateTagsStr($doc); |
|
79 //dispatch event |
|
80 $event_dispatcher = $this->getContainer()->get('event_dispatcher'); |
|
81 $event = new DocumentTagEvent($doc); |
|
82 $event_dispatcher->dispatch(WikiTagEvents::onTagChanged, $event); |
|
83 |
78 if($done%10 == 0) |
84 if($done%10 == 0) |
79 { |
85 { |
80 $doctrine->getEntityManager()->flush(); |
86 $doctrine->getEntityManager()->flush(); |
81 foreach($todetach as $obj) |
87 foreach($todetach as $obj) |
82 { |
88 { |