public function generateKeywordsAction()
    {
        $applications = $this->fetchApplications();
        $count        = count($applications);
        $repositories = $this->repositories; //->get('Applications/Application');

        if (0 === $count) {
            return 'No applications found.';
        }
        
        // preUpdate includes a modified date, and we don't want that
        foreach ($repositories->getEventManager()->getListeners('preUpdate') as $listener) {
            $repositories->getEventManager()->removeEventListener('preUpdate', $listener);
        }
                
        echo "Generate keywords for $count applications ...\n";
        
        $progress     = new ProgressBar($count);

        /** @var \Core\Repository\Filter\PropertyToKeywords $filter */
        $filter = $this->filterManager->get('Core/Repository/PropertyToKeywords');
        $i = 0;

        /** @var \Applications\Entity\Application $application */
        foreach ($applications as $application) {
            $progress->update($i++, 'Application ' . $i . ' / ' . $count);
            $keywords = $filter->filter($application);
            
            $application->setKeywords($keywords);
            
            if (0 == $i % 500) {
                $progress->update($i, 'Write to database...');
                $repositories->flush();
            }
        }
        $progress->update($i, 'Write to database...');
        $repositories->flush();
        $progress->finish();
        
        return PHP_EOL;
    }
public function generateKeywordsAction()
    {
        $applications = $this->fetchApplications();
        $count        = count($applications);
        $repositories = $this->repositories; //->get('Applications/Application');

        if (0 === $count) {
            return 'No applications found.';
        }
        
        // preUpdate includes a modified date, and we don't want that
        foreach ($repositories->getEventManager()->getListeners('preUpdate') as $listener) {
            $repositories->getEventManager()->removeEventListener('preUpdate', $listener);
        }
                
        echo "Generate keywords for $count applications ...\n";
        
        $progress     = new ProgressBar($count);

        /** @var \Core\Repository\Filter\PropertyToKeywords $filter */
        $filter = $this->filterManager->get('Core/Repository/PropertyToKeywords');
        $i = 0;

        /** @var \Applications\Entity\Application $application */
        foreach ($applications as $application) {
            $progress->update($i++, 'Application ' . $i . ' / ' . $count);
            $keywords = $filter->filter($application);
            
            $application->setKeywords($keywords);
            
            if (0 == $i % 500) {
                $progress->update($i, 'Write to database...');
                $repositories->flush();
            }
        }
        $progress->update($i, 'Write to database...');
        $repositories->flush();
        $progress->finish();
        
        return PHP_EOL;
    }
public function generateKeywordsAction ( ) { $ applications = $ this -> fetchApplications ( ) ; $ count = count ( $ applications ) ; $ repositories = $ this -> repositories ; //->get('Applications/Application'); if ( 0 === $ count ) { return 'No applications found.' ; } // preUpdate includes a modified date, and we don't want that foreach ( $ repositories -> getEventManager ( ) -> getListeners ( 'preUpdate' ) as $ listener ) { $ repositories -> getEventManager ( ) -> removeEventListener ( 'preUpdate' , $ listener ) ; } echo "Generate keywords for $count applications ...\n" ; $ progress = new ProgressBar ( $ count ) ; /** @var \Core\Repository\Filter\PropertyToKeywords $filter */ $ filter = $ this -> filterManager -> get ( 'Core/Repository/PropertyToKeywords' ) ; $ i = 0 ; /** @var \Applications\Entity\Application $application */ foreach ( $ applications as $ application ) { $ progress -> update ( $ i ++ , 'Application ' . $ i . ' / ' . $ count ) ; $ keywords = $ filter -> filter ( $ application ) ; $ application -> setKeywords ( $ keywords ) ; if ( 0 == $ i % 500 ) { $ progress -> update ( $ i , 'Write to database...' ) ; $ repositories -> flush ( ) ; } } $ progress -> update ( $ i , 'Write to database...' ) ; $ repositories -> flush ( ) ; $ progress -> finish ( ) ; return PHP_EOL ; }
regenerate keywords for applications

@return string
regenerate keywords for applications