small fixes

This commit is contained in:
2022-01-26 17:56:47 +01:00
parent 04bc79b36d
commit b4380aeb95
4 changed files with 21 additions and 26 deletions

View File

@@ -70,36 +70,25 @@ final class HomePresenter extends BaseFrontPresenter
protected function doSearch($query,$translation,$term,$clen = null,$paginate = true)
{
$t = $this->em->getTranslationRepository()->find($translation);
if ($term) $this->term = $term;
if ($translation) $this->translation = $translation;
$this->slug = $this->translations[$translation]["slug"];
$this->termFacade->setDirection(1);
$result = $this->termFacade->findByString();
//$repo_query = "\\App\\Model\\Database\\Repository\\$query";
/*
if ($term) $this->term = $term;
if ($translation) $this->translation = $translation;
$this->slug = $this->translations[$translation]["slug"];
$query = new $repo_query($t->getDictionary(),$this->term,$t->getDirection());
if ($clen) $query->withClen($clen);
$result = $this->em->getTermRepository()->fetch($query)->setFetchJoinCollection(FALSE);
if ($paginate) {
$this["paginator"]->setItemCount(count($result));
$result->applyPaginator($this['paginator']);
$offset = $this['paginator']->getOffset();
$this["paginator"]->setItemCount(500);
$offset = $this["paginator"]->getOffset();
$itemsPerPage = $this['paginator']->getItemsPerPage();
}
*/
$t = $this->em->getTranslationRepository()->find($translation);
$q = $this->termFacade->findByString($term,$t->dictionary,$clen);
$q->setMaxResults(500)->setFirstResult($offset)->getMaxResults($itemsPerPage);
$this->template->translation = $t;
return $result;
return $q->getResult();
}
/**
@@ -111,6 +100,8 @@ final class HomePresenter extends BaseFrontPresenter
$paginator->ajax = false;
$paginator->canSetItemsPerPage = true;
$paginator->setItemsPerPage(100);
//$paginator->templateFile = __DIR__ . '/my_awesome_template.latte';
return $paginator;
@@ -131,7 +122,7 @@ final class HomePresenter extends BaseFrontPresenter
public function searchFormSucceeded(UI\Form $form,$values)
{
$translation = $values->translation;
$translation = $values->translation;
$clen = $values->clen;
$term = $values->string;