Rabatt export, optimize

This commit is contained in:
Kevin Adametz 2019-11-07 17:09:18 +01:00
parent 54fc46ace4
commit f2be8e54b4
23 changed files with 552 additions and 34 deletions

View file

@ -9,6 +9,7 @@ namespace AppBundle\Service;
use AppBundle\Entity\Keyword;
use AppBundle\Entity\Page;
use AppBundle\Util;
use Doctrine\ORM\EntityManager;
class KeywordService
@ -134,8 +135,7 @@ class KeywordService
if($dict === null)
{
$dict = [];
$keywords = $this->entityManager->getRepository('AppBundle:Keyword')->findAll();
/** @var Keyword $keyword */
/* $keywords = $this->entityManager->getRepository('AppBundle:Keyword')->findAll();
foreach($keywords as $keyword)
{
if(isset($dict[$keyword->getValue()]))
@ -156,7 +156,6 @@ class KeywordService
->getQuery()
->execute()
;
/** @var Page $page */
foreach($pages as $page)
{
if(isset($dict[$page->getKeyword()]))
@ -169,6 +168,23 @@ class KeywordService
$dict[$page->getKeyword()] = $dictEntry;
}
}
*/
/** @var Page $page */
$keywords = Util::loadFromApi('cms/keywords', ['url'=>'']);
foreach($keywords as $keyword => $url)
{
if(isset($dict[$keyword]))
{
continue;
}
$dictEntry = $this->createKeywordDictEntry("/".$url, $keyword, $classes);
if ($dictEntry !== null)
{
$dict[$keyword] = $dictEntry;
}
}
}
return $dict;
}