equal
deleted
inserted
replaced
52 $total = $querycount->getSingleScalarResult(); |
52 $total = $querycount->getSingleScalarResult(); |
53 $search_service = $this->getContainer()->get('wiki_tag.search'); |
53 $search_service = $this->getContainer()->get('wiki_tag.search'); |
54 |
54 |
55 $done = 0; |
55 $done = 0; |
56 $iterable = $query->iterate(); |
56 $iterable = $query->iterate(); |
57 $todetach = array(); |
|
58 while (($row = $iterable->next()) !== false) |
57 while (($row = $iterable->next()) !== false) |
59 { |
58 { |
60 $done++; |
59 $done++; |
61 $doc = $row[0]; |
60 $doc = $row[0]; |
62 |
61 |
64 |
63 |
65 $doc->setManualOrder(false); |
64 $doc->setManualOrder(false); |
66 $doctrine->getEntityManager()->persist($doc); |
65 $doctrine->getEntityManager()->persist($doc); |
67 |
66 |
68 $search_service->reorderTagsForDocument($doc); |
67 $search_service->reorderTagsForDocument($doc); |
69 $todetach[] = $doc; |
|
70 |
68 |
71 |
69 |
72 if($done%100 == 0) |
70 if($done%100 == 0) |
73 { |
71 { |
74 $doctrine->getEntityManager()->flush(); |
72 $doctrine->getEntityManager()->flush(); |
75 $doctrine->getEntityManager()->clear(); |
73 $doctrine->getEntityManager()->clear(); |
76 /*foreach($todetach as $obj) |
|
77 { |
|
78 $doctrine->getEntityManager()->detach($obj); |
|
79 }*/ |
|
80 $todetach = array(); |
74 $todetach = array(); |
81 $output->writeln("memory : ".strval(memory_get_usage(true))); |
75 $output->writeln("memory : ".strval(memory_get_usage(true))); |
82 } |
76 } |
83 |
77 |
84 } |
78 } |