This commit is contained in:
2022-01-16 22:48:28 +01:00
parent 849aa6d5b1
commit 1ead7f5741

View File

@@ -35,19 +35,19 @@ final class HomePresenter extends BaseFrontPresenter
protected function startup() protected function startup()
{ {
$trs = $this->em->getRepository(Translation::class)->findBy([],['id' => 'ASC','direction'=>'ASC']); $trs = $this->em->getRepository(Translation::class)->findBy([],['id' => 'ASC','direction'=>'ASC']);
$drs = $this->em->getRepository(Dictionary::class)->findPairs([],'name',[],'id'); $drs = $this->em->getRepository(Dictionary::class)->findPairs('id','name');
$select = []; $select = [];
foreach ($trs as $t) { foreach ($trs as $t) {
$lang1 = $t->langName1; $lang1 = $t->getLangName1();
$lang2 = $t->langName2; $lang2 = $t->getLangName2();
$lang = mb_substr($lang1,0,-1); $lang = mb_substr($lang1,0,-1);
$lang .= "o-".$lang2; $lang .= "o-".$lang2;
$slug = Strings::webalize($lang); $slug = Strings::webalize($lang);
$select[$drs[$t->dictionary->id]][$t->id] = $lang; $select[$drs[$t->getDictionary()->getId()]][$t->getId()] = $lang;
$translations[$t->id]["slug"] = $slug; $translations[$t->getId()]["slug"] = $slug;
$translations[$t->id]["lang"] = $lang; $translations[$t->getId()]["lang"] = $lang;
$translations[$t->id]["t"] = $t; $translations[$t->getId()]["t"] = $t;
$slugs[$slug] = $t; $slugs[$slug] = $t;
} }
@@ -154,7 +154,7 @@ final class HomePresenter extends BaseFrontPresenter
public function beforeRender() public function beforeRender()
{ {
$dicttypes = $this->repoDictTypes->findAssoc([],'id'); $dicttypes = $this->em->getDictTypeRepository()->findPairs('id');
$this->template->dicttypes = $dicttypes; $this->template->dicttypes = $dicttypes;
$this->template->dictionaries = $this->dictionaries; $this->template->dictionaries = $this->dictionaries;
$this->template->translations = $this->translations; $this->template->translations = $this->translations;