Command/SyncDocumentsCommand.php
changeset 24 cd389bf882f1
parent 23 b435f8055cb4
child 27 8551d844b4f3
equal deleted inserted replaced
23:b435f8055cb4 24:cd389bf882f1
    48         }
    48         }
    49         
    49         
    50         //TODO : check class to implement DocumentInterface
    50         //TODO : check class to implement DocumentInterface
    51         //TODO : write progress
    51         //TODO : write progress
    52         $doclist = $rep->findAll();
    52         $doclist = $rep->findAll();
       
    53         $total = count($doclist);
       
    54         $done = 0;
    53         foreach ($doclist as $doc) {
    55         foreach ($doclist as $doc) {
       
    56             $done++;
       
    57             $output->writeln("Process doc id ".$doc->getId()." $done/$total ".strval(intval(floatval($done)/floatval($total)*100.0))."%");
    54             $docrep->writeDocument($doc, $this->getContainer()->getParameter('wiki_tag.document_id_column'), $this->getContainer()->getParameter('wiki_tag.fields'));
    58             $docrep->writeDocument($doc, $this->getContainer()->getParameter('wiki_tag.document_id_column'), $this->getContainer()->getParameter('wiki_tag.fields'));
    55         }
    59         }
    56         $doctrine->getEntityManager()->flush();
    60         $doctrine->getEntityManager()->flush();
    57         
    61         
    58         if($clear) {
    62         if($clear) {