Nette 3.0 fixes
This commit is contained in:
@@ -14,12 +14,21 @@ use App\Model\Database\EntityManager;
|
||||
use App\Model\Database\Entity\Dictionary;
|
||||
use App\Model\Database\Entity\Translation;
|
||||
use App\Model\Database\Repository\TranslationRepository;
|
||||
use App\Model\Database\Repository\TermsFullQuery;
|
||||
use App\Model\Database\Repository\TermsQuickQuery;
|
||||
use App\Model\Database\Facade\TermFacade;
|
||||
|
||||
final class HomePresenter extends BaseFrontPresenter
|
||||
{
|
||||
|
||||
|
||||
/** @inject @var \App\Model\Database\EntityManager */
|
||||
public $em;
|
||||
/** @inject */
|
||||
public VisualPaginatorFactory $visualPaginatorFactory;
|
||||
/** @inject */
|
||||
public TermFacade $termFacade;
|
||||
|
||||
|
||||
private $translations;
|
||||
private $dictionaries;
|
||||
@@ -61,24 +70,33 @@ 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 $query($t->dictionary,$this->term,$t->direction);
|
||||
|
||||
|
||||
$query = new $repo_query($t->getDictionary(),$this->term,$t->getDirection());
|
||||
|
||||
if ($clen) $query->withClen($clen);
|
||||
$result = $this->repoTerms->fetch($query)->setFetchJoinCollection(FALSE);
|
||||
|
||||
$result = $this->em->getTermRepository()->fetch($query)->setFetchJoinCollection(FALSE);
|
||||
|
||||
if ($paginate) {
|
||||
$this["paginator"]->setItemCount($result->getTotalCount());
|
||||
$result->applyPaginator($paginator);
|
||||
$offset = $this['paginator']->getOffset();
|
||||
$itemsPerPage = $this['paginator']->getItemsPerPage();
|
||||
$this["paginator"]->setItemCount($result->getTotalCount());
|
||||
$result->applyPaginator($this['paginator']);
|
||||
$offset = $this['paginator']->getOffset();
|
||||
$itemsPerPage = $this['paginator']->getItemsPerPage();
|
||||
}
|
||||
|
||||
*/
|
||||
$t = $this->em->getTranslationRepository()->find($translation);
|
||||
$this->template->translation = $t;
|
||||
|
||||
return $result;
|
||||
@@ -117,9 +135,8 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
$clen = $values->clen;
|
||||
$term = $values->string;
|
||||
|
||||
$result = $this->doSearch('\\App\\Model\\Database\\Repository\\TermsQuery',$translation,$term,$clen);
|
||||
|
||||
$this->template->result = $result;
|
||||
$result = $this->doSearch('TermsQuery',$translation,$term,$clen);
|
||||
$this->template->result = $result;
|
||||
}
|
||||
|
||||
public function searchFormSucceededIpa(UI\Form $form,$values)
|
||||
@@ -128,7 +145,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
$term = $values->string;
|
||||
$clen = $values->clen;
|
||||
|
||||
$result = $this->doSearch('\\App\\Model\\Database\\Repository\\TermsFullQuery',$translation,$term,$clen);
|
||||
$result = $this->doSearch('TermsFullQuery',$translation,$term,$clen);
|
||||
|
||||
$this->template->result = $result;
|
||||
}
|
||||
@@ -138,7 +155,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
$term = $values->string;
|
||||
$translation = $values->translation;
|
||||
|
||||
$result = $this->doSearch('\\App\\Model\\Database\\Repository\\TermsFullQuery',$translation,$term,null);
|
||||
$result = $this->doSearch('TermsFullQuery',$translation,$term,null);
|
||||
|
||||
$this->template->result = $result;
|
||||
}
|
||||
@@ -166,7 +183,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
if ($this->getRequest()->isMethod('GET') && $this->term) {
|
||||
$this['searchForm']['string']->setValue($this->term);
|
||||
$t = $this->slugs[$this->slug];
|
||||
$result = $this->doSearch('\\App\\Model\\Database\\Repository\\TermsQuery',$t->id,$this->term);
|
||||
$result = $this->doSearch('TermsQuery',$t->id,$this->term);
|
||||
if ($result) $this->template->result = $result;
|
||||
}
|
||||
|
||||
@@ -190,7 +207,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
}
|
||||
}
|
||||
if ($term) {
|
||||
$query = new \App\Model\Database\Repository\TermsFullQuery($translation->dictionary,$term,$translation->direction);
|
||||
$query = new TermsFullQuery($translation->dictionary,$term,$translation->direction);
|
||||
$result = $this->repoTerms->fetch($query);
|
||||
|
||||
$this->template->result = $result;
|
||||
@@ -206,7 +223,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
|
||||
$dictionary = $term->dictionary;
|
||||
|
||||
$query = new \App\Model\Database\Repository\TermsFullQuery($dictionary,$term->string1,1,false);
|
||||
$query = new TermsFullQuery($dictionary,$term->string1,1,false);
|
||||
$result = $this->repoTerms->fetch($query);
|
||||
|
||||
$this->template->result = $result;
|
||||
@@ -224,7 +241,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
if ($this->getRequest()->isMethod('GET')) {
|
||||
if ($this->term) {
|
||||
$this['searchForm']['string']->setValue($this->term);
|
||||
$result = $this->doSearch('\\App\\Model\\Database\\Repository\\TermsFullQuery',$this->slugs[$this->slug]->id,$this->term);
|
||||
$result = $this->doSearch('TermsFullQuery',$this->slugs[$this->slug]->id,$this->term);
|
||||
if ($result) $this->template->result = $result;
|
||||
}
|
||||
}
|
||||
@@ -237,7 +254,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
if ($this->getRequest()->isMethod('GET')) {
|
||||
if ($this->term) {
|
||||
$this['searchForm']['string']->setValue($this->term);
|
||||
$result = $this->doSearch('\\App\\Model\\Database\\Repository\\TermsFullQuery',$this->slugs[$this->slug]->id,$this->term);
|
||||
$result = $this->doSearch('TermsFullQuery',$this->slugs[$this->slug]->id,$this->term);
|
||||
if ($result) $this->template->result = $result;
|
||||
}
|
||||
}
|
||||
@@ -249,7 +266,7 @@ final class HomePresenter extends BaseFrontPresenter
|
||||
{
|
||||
$translation = $this->repoTranslations->find($translation);
|
||||
|
||||
$query = new \App\Model\Database\Repository\TermsQuickQuery($translation->dictionary,$typedText,$translation->direction);
|
||||
$query = new TermsQuickQuery($translation->dictionary,$typedText,$translation->direction);
|
||||
$result = $this->repoTerms->fetch($query);
|
||||
|
||||
$map = [];
|
||||
|
||||
Reference in New Issue
Block a user