Repository fix
This commit is contained in:
18
app/model/Database/Repository/DictTypeRepository.php
Normal file
18
app/model/Database/Repository/DictTypeRepository.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace App\Model\Database\Repository;
|
||||
|
||||
use App\Model\Database\Entity\DictType;
|
||||
|
||||
/**
|
||||
* @method DictType|NULL find($id, ?int $lockMode = NULL, ?int $lockVersion = NULL)
|
||||
* @method DictType|NULL findOneBy(array $criteria, array $orderBy = NULL)
|
||||
* @method DictType[] findAll()
|
||||
* @method DictType[] findBy(array $criteria, array $orderBy = NULL, ?int $limit = NULL, ?int $offset = NULL)
|
||||
* @extends AbstractRepository<DictType>
|
||||
*/
|
||||
class DictTypeRepository extends AbstractRepository
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Kdyby;
|
||||
use Nette;
|
||||
|
||||
class DictTypes extends Nette\Object
|
||||
{
|
||||
private $em;
|
||||
private $dicttypes;
|
||||
|
||||
public function __construct(Kdyby\Doctrine\EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->dicttypes = $em->getRepository(DictType::class);
|
||||
}
|
||||
|
||||
public function find($value)
|
||||
{
|
||||
return $this->dicttypes->find($value);
|
||||
}
|
||||
|
||||
|
||||
public function findBy($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->dicttypes->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function findPairs($criteria,$value,$orderBy,$key)
|
||||
{
|
||||
return $this->dicttypes->findPairs($criteria,$value,$orderBy,$key);
|
||||
}
|
||||
|
||||
public function findAssoc($criteria, $key = NULL)
|
||||
{
|
||||
return $this->dicttypes->findAssoc($criteria,$key);
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Kdyby;
|
||||
use Nette;
|
||||
|
||||
class Dictionaries extends Nette\Object
|
||||
{
|
||||
private $em;
|
||||
private $dictionaries;
|
||||
|
||||
public function __construct(Kdyby\Doctrine\EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->dictionaries = $em->getRepository(Dictionary::class);
|
||||
}
|
||||
|
||||
public function findAll($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->dictionaries->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function findPairs($criteria,$value,$orderBy,$key)
|
||||
{
|
||||
return $this->dictionaries->findPairs($criteria,$value,$orderBy,$key);
|
||||
}
|
||||
}
|
||||
18
app/model/Database/Repository/DictionaryRepository.php
Normal file
18
app/model/Database/Repository/DictionaryRepository.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace App\Model\Database\Repository;
|
||||
|
||||
use App\Model\Database\Entity\Dictionary;
|
||||
|
||||
/**
|
||||
* @method Dictionary|NULL find($id, ?int $lockMode = NULL, ?int $lockVersion = NULL)
|
||||
* @method Dictionary|NULL findOneBy(array $criteria, array $orderBy = NULL)
|
||||
* @method Dictionary[] findAll()
|
||||
* @method Dictionary[] findBy(array $criteria, array $orderBy = NULL, ?int $limit = NULL, ?int $offset = NULL)
|
||||
* @extends AbstractRepository<Dictionary>
|
||||
*/
|
||||
class DictionaryRepository extends AbstractRepository
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
16
app/model/Database/Repository/PronunciationRepository.php
Normal file
16
app/model/Database/Repository/PronunciationRepository.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace App\Model\Database\Repository;
|
||||
|
||||
use App\Model\Database\Entity\Pronunciation;
|
||||
/**
|
||||
* @method Pronunciation|NULL find($id, ?int $lockMode = NULL, ?int $lockVersion = NULL)
|
||||
* @method Pronunciation|NULL findOneBy(array $criteria, array $orderBy = NULL)
|
||||
* @method Pronunciation[] findAll()
|
||||
* @method Pronunciation[] findBy(array $criteria, array $orderBy = NULL, ?int $limit = NULL, ?int $offset = NULL)
|
||||
* @extends AbstractRepository<Pronunciation>
|
||||
*/
|
||||
class PronunciationRepository extends AbstractRepository
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Kdyby;
|
||||
use Nette;
|
||||
|
||||
class Pronunciations extends Nette\Object
|
||||
{
|
||||
private $em;
|
||||
private $pronunciations;
|
||||
|
||||
public function __construct(Kdyby\Doctrine\EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->pronunciations = $em->getRepository(Pronunciation::class);
|
||||
}
|
||||
|
||||
public function find($value)
|
||||
{
|
||||
return $this->pronunciations->find($value);
|
||||
}
|
||||
|
||||
|
||||
public function findBy($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->pronunciations->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function findPairs($criteria,$value,$orderBy,$key)
|
||||
{
|
||||
return $this->pronunciations->findPairs($criteria,$value,$orderBy,$key);
|
||||
}
|
||||
}
|
||||
18
app/model/Database/Repository/TermFlagRepository.php
Normal file
18
app/model/Database/Repository/TermFlagRepository.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace App\Model\Database\Repository;
|
||||
|
||||
use App\Model\Database\Entity\TermFlag;
|
||||
|
||||
/**
|
||||
* @method TermFlag|NULL find($id, ?int $lockMode = NULL, ?int $lockVersion = NULL)
|
||||
* @method TermFlag|NULL findOneBy(array $criteria, array $orderBy = NULL)
|
||||
* @method TermFlag[] findAll()
|
||||
* @method TermFlag[] findBy(array $criteria, array $orderBy = NULL, ?int $limit = NULL, ?int $offset = NULL)
|
||||
* @extends AbstractRepository<TermFlag>
|
||||
*/
|
||||
class TermFlagRepository extends AbstractRepository
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Kdyby;
|
||||
use Nette;
|
||||
|
||||
class TermFlags extends Nette\Object
|
||||
{
|
||||
private $em;
|
||||
private $termFlags;
|
||||
|
||||
public function __construct(Kdyby\Doctrine\EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->termFlags = $em->getRepository(TermFlag::class);
|
||||
}
|
||||
|
||||
public function find($value)
|
||||
{
|
||||
return $this->termFlags->find($value);
|
||||
}
|
||||
|
||||
public function findBy($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->termFlags->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function findPairs($criteria,$value,$orderBy,$key)
|
||||
{
|
||||
return $this->termFlags->findPairs($criteria,$value,$orderBy,$key);
|
||||
}
|
||||
|
||||
public function findAssoc($criteria,$key)
|
||||
{
|
||||
return $this->termFlags->findAssoc($criteria,$key);
|
||||
}
|
||||
}
|
||||
18
app/model/Database/Repository/TermRepository.php
Normal file
18
app/model/Database/Repository/TermRepository.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace App\Model\Database\Repository;
|
||||
|
||||
use App\Model\Database\Entity\Term;
|
||||
|
||||
/**
|
||||
* @method Term|NULL find($id, ?int $lockMode = NULL, ?int $lockVersion = NULL)
|
||||
* @method Term|NULL findOneBy(array $criteria, array $orderBy = NULL)
|
||||
* @method Term[] findAll()
|
||||
* @method Term[] findBy(array $criteria, array $orderBy = NULL, ?int $limit = NULL, ?int $offset = NULL)
|
||||
* @extends AbstractRepository<Term>
|
||||
*/
|
||||
class TermRepository extends AbstractRepository
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Kdyby;
|
||||
use Nette;
|
||||
|
||||
class Terms extends Nette\Object
|
||||
{
|
||||
private $em;
|
||||
private $termsDao;
|
||||
private $terms;
|
||||
|
||||
public function __construct(Kdyby\Doctrine\EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->terms = $em->getRepository(Term::class);
|
||||
$this->termsDao = $em->getDao(Term::class);
|
||||
}
|
||||
|
||||
public function findAll($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->terms->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function findBy($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->terms->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function find($id)
|
||||
{
|
||||
return $this->terms->find($id);
|
||||
}
|
||||
|
||||
|
||||
public function findPairs($criteria,$value,$orderBy,$key)
|
||||
{
|
||||
return $this->terms->findPairs($criteria,$value,$orderBy,$key);
|
||||
}
|
||||
|
||||
public function fetch($query)
|
||||
{
|
||||
return $this->termsDao->fetch($query);
|
||||
}
|
||||
|
||||
}
|
||||
16
app/model/Database/Repository/TranslationRepository.php
Normal file
16
app/model/Database/Repository/TranslationRepository.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php declare(strict_types = 1);
|
||||
|
||||
namespace App\Model\Database\Repository;
|
||||
|
||||
use App\Model\Database\Entity\Translation;
|
||||
/**
|
||||
* @method Translation|NULL find($id, ?int $lockMode = NULL, ?int $lockVersion = NULL)
|
||||
* @method Translation|NULL findOneBy(array $criteria, array $orderBy = NULL)
|
||||
* @method Translation[] findAll()
|
||||
* @method Translation[] findBy(array $criteria, array $orderBy = NULL, ?int $limit = NULL, ?int $offset = NULL)
|
||||
* @extends AbstractRepository<Translation>
|
||||
*/
|
||||
class TranslationRepository extends AbstractRepository
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
namespace App;
|
||||
|
||||
use Kdyby;
|
||||
use Nette;
|
||||
|
||||
class Translations extends Nette\Object
|
||||
{
|
||||
private $em;
|
||||
private $translations;
|
||||
|
||||
public function __construct(Kdyby\Doctrine\EntityManager $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->translations = $em->getRepository(Translation::class);
|
||||
}
|
||||
|
||||
public function find($value)
|
||||
{
|
||||
return $this->translations->find($value);
|
||||
}
|
||||
|
||||
|
||||
public function findBy($criteria = [],$orderBy = [])
|
||||
{
|
||||
return $this->translations->findBy($criteria,$orderBy);
|
||||
}
|
||||
|
||||
public function findPairs($criteria,$value,$orderBy,$key)
|
||||
{
|
||||
return $this->translations->findPairs($criteria,$value,$orderBy,$key);
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,14 @@
|
||||
namespace App\Model\Database;
|
||||
|
||||
use App\Model\Database\Entity\User;
|
||||
use App\Model\Database\Entity\Translation;
|
||||
use App\Model\Database\Repository\UserRepository;
|
||||
use App\Model\Database\Repository\TranslationRepository;
|
||||
use App\Model\Database\Repository\TermRepository;
|
||||
use App\Model\Database\Repository\TermFlagRepository;
|
||||
use App\Model\Database\Repository\PronunciationRepository;
|
||||
use App\Model\Database\Repository\DictTypeRepository;
|
||||
use App\Model\Database\Repository\DictionaryRepository;
|
||||
|
||||
/**
|
||||
* @mixin EntityManager
|
||||
@@ -16,4 +23,34 @@ trait TRepositories
|
||||
return $this->getRepository(User::class);
|
||||
}
|
||||
|
||||
public function getTranslationRepository(): TranslationRepository
|
||||
{
|
||||
return $this->getRepository(Translation::class);
|
||||
}
|
||||
|
||||
public function getTermRepository(): TermRepository
|
||||
{
|
||||
return $this->getRepository(Term::class);
|
||||
}
|
||||
|
||||
public function getTermFlagRepository(): TermFlagRepository
|
||||
{
|
||||
return $this->getRepository(TermFlag::class);
|
||||
}
|
||||
|
||||
public function getPronunciationRepository(): PronunciationRepository
|
||||
{
|
||||
return $this->getRepository(Pronunciation::class);
|
||||
}
|
||||
|
||||
public function getDictTypeRepository(): DictTypeRepository
|
||||
{
|
||||
return $this->getRepository(DictType::class);
|
||||
}
|
||||
|
||||
public function getDictionaryRepository(): DictionaryRepository
|
||||
{
|
||||
return $this->getRepository(Dictionary::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,281 @@
|
||||
|
||||
namespace App\Modules\Front\Home;
|
||||
|
||||
use Nette;
|
||||
use Nette\Utils\Strings;
|
||||
use Nette\Application\UI;
|
||||
use Dict\OggResponse;
|
||||
use Nette\Application\Responses\JsonResponse;
|
||||
use AlesWita\VisualPaginator\VisualPaginator;
|
||||
use AlesWita\VisualPaginator\VisualPaginatorFactory;
|
||||
|
||||
use App\Modules\Front\BaseFrontPresenter;
|
||||
|
||||
final class HomePresenter extends BaseFrontPresenter
|
||||
{
|
||||
|
||||
|
||||
/** @inject @var \App\Translations */
|
||||
public $repoTranslations;
|
||||
/** @inject @var \App\Pronunciations */
|
||||
public $repoPronunciations;
|
||||
/** @inject @var \App\Dictionaries */
|
||||
public $repoDictionaries;
|
||||
/** @inject @var \App\DictTypes */
|
||||
public $repoDictTypes;
|
||||
/** @inject @var \App\Terms */
|
||||
public $repoTerms;
|
||||
/** @inject @var \App\TermFlags */
|
||||
public $repoTermFlags;
|
||||
|
||||
private $translations;
|
||||
private $dictionaries;
|
||||
private $drsSelect;
|
||||
private $slugs;
|
||||
public $translation;
|
||||
|
||||
/** @persistent */
|
||||
public $term;
|
||||
/** @persistent */
|
||||
public $slug;
|
||||
|
||||
protected function startup()
|
||||
{
|
||||
$trs = $this->repoTranslations->findBy([],['id' => 'ASC','direction'=>'ASC']);
|
||||
$drs = $this->repoDictionaries->findPairs([],'name',[],'id');
|
||||
$select = [];
|
||||
foreach ($trs as $t) {
|
||||
$lang1 = $t->langName1;
|
||||
$lang2 = $t->langName2;
|
||||
|
||||
$lang = mb_substr($lang1,0,-1);
|
||||
$lang .= "o-".$lang2;
|
||||
$slug = Strings::webalize($lang);
|
||||
$select[$drs[$t->dictionary->id]][$t->id] = $lang;
|
||||
$translations[$t->id]["slug"] = $slug;
|
||||
$translations[$t->id]["lang"] = $lang;
|
||||
$translations[$t->id]["t"] = $t;
|
||||
$slugs[$slug] = $t;
|
||||
|
||||
}
|
||||
$this->translations = $translations;
|
||||
$this->dictionaries = $drs;
|
||||
$this->drsSelect = $select;
|
||||
$this->slugs = $slugs;
|
||||
|
||||
parent::startup();
|
||||
}
|
||||
|
||||
protected function doSearch($query,$translation,$term,$clen = null,$paginate = true)
|
||||
{
|
||||
$t = $this->repoTranslations->find($translation);
|
||||
|
||||
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);
|
||||
|
||||
if ($clen) $query->withClen($clen);
|
||||
$result = $this->repoTerms->fetch($query)->setFetchJoinCollection(FALSE);
|
||||
|
||||
if ($paginate) {
|
||||
$this["paginator"]->setItemCount($result->getTotalCount());
|
||||
$result->applyPaginator($paginator);
|
||||
$offset = $this['paginator']->getOffset();
|
||||
$itemsPerPage = $this['paginator']->getItemsPerPage();
|
||||
}
|
||||
|
||||
$this->template->translation = $t;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AlesWita\Components\VisualPaginator
|
||||
*/
|
||||
protected function createComponentPaginator(): VisualPaginator
|
||||
{
|
||||
$paginator = $this->visualPaginatorFactory->create();
|
||||
|
||||
$paginator->ajax = false;
|
||||
$paginator->canSetItemsPerPage = true;
|
||||
//$paginator->templateFile = __DIR__ . '/my_awesome_template.latte';
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
protected function createComponentSearchForm()
|
||||
{
|
||||
$form = new UI\Form;
|
||||
$form->addText('string', 'Výraz')
|
||||
->setRequired('Zadajte výray');
|
||||
$form->addSelect('translation', 'Preklad', $this->drsSelect)
|
||||
->setDefaultValue(1)
|
||||
->setRequired('Vyberte slovnik');
|
||||
$form->addText('clen','Clen',5);
|
||||
$form->addSubmit('search', 'Vyhaľadaj');
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function searchFormSucceeded(UI\Form $form,$values)
|
||||
{
|
||||
$translation = $values->translation;
|
||||
$clen = $values->clen;
|
||||
$term = $values->string;
|
||||
|
||||
$result = $this->doSearch('\\App\\TermsQuery',$translation,$term,$clen);
|
||||
|
||||
$this->template->result = $result;
|
||||
}
|
||||
|
||||
public function searchFormSucceededIpa(UI\Form $form,$values)
|
||||
{
|
||||
$translation = $values->translation;
|
||||
$term = $values->string;
|
||||
$clen = $values->clen;
|
||||
|
||||
$result = $this->doSearch('\\App\\TermsFullQuery',$translation,$term,$clen);
|
||||
|
||||
$this->template->result = $result;
|
||||
}
|
||||
|
||||
public function searchFormSucceededInteractive(UI\Form $form,$values)
|
||||
{
|
||||
$term = $values->string;
|
||||
$translation = $values->translation;
|
||||
|
||||
$result = $this->doSearch('\\App\\TermsFullQuery',$translation,$term,null);
|
||||
|
||||
$this->template->result = $result;
|
||||
}
|
||||
|
||||
public function actionPlay($id = null)
|
||||
{
|
||||
$pron = $this->repoPronunciations->find(['id'=>$id]);
|
||||
$basepath = $this->getHttpRequest()->url->basePath . "/media";
|
||||
$oggResp = new OggResponse($id,$pron->filename);
|
||||
return $this->sendResponse($oggResp);
|
||||
|
||||
}
|
||||
|
||||
public function beforeRender()
|
||||
{
|
||||
$dicttypes = $this->repoDictTypes->findAssoc([],'id');
|
||||
$this->template->dicttypes = $dicttypes;
|
||||
$this->template->dictionaries = $this->dictionaries;
|
||||
$this->template->translations = $this->translations;
|
||||
// $this->template->paginator = $this->paginator;
|
||||
}
|
||||
|
||||
public function actionDefault()
|
||||
{
|
||||
if ($this->getRequest()->isMethod('GET') && $this->term) {
|
||||
$this['searchForm']['string']->setValue($this->term);
|
||||
$t = $this->slugs[$this->slug];
|
||||
$result = $this->doSearch('\\App\\TermsQuery',$t->id,$this->term);
|
||||
if ($result) $this->template->result = $result;
|
||||
}
|
||||
|
||||
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceeded');
|
||||
}
|
||||
|
||||
public function actionSelect($slug,$term = null)
|
||||
{
|
||||
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
|
||||
if ($this->getRequest()->isMethod('GET')) {
|
||||
if (isset($this->slugs[$slug])) {
|
||||
$t = $this->slugs[$slug];
|
||||
$this['searchForm']['translation']->setValue($t->id);
|
||||
$translation = $t;
|
||||
}
|
||||
} else {
|
||||
$id = $this['searchForm']['translation']->value;
|
||||
if (isset($this->translations[$id])) {
|
||||
$t = $this->translations[$id];
|
||||
$this->redirect('Homepage:select',$t["slug"],$this['searchForm']['string']->value);
|
||||
}
|
||||
}
|
||||
if ($term) {
|
||||
$query = new \App\TermsFullQuery($translation->dictionary,$term,$translation->direction);
|
||||
$result = $this->repoTerms->fetch($query);
|
||||
|
||||
$this->template->result = $result;
|
||||
$this->template->translation = $translation;
|
||||
}
|
||||
$this->setView('ipa');
|
||||
}
|
||||
|
||||
public function handleGetInfo($id)
|
||||
{
|
||||
$term = $this->repoTerms->find($id);
|
||||
$termFlags = $this->repoTermFlags->findAssoc([],'id');
|
||||
|
||||
$dictionary = $term->dictionary;
|
||||
|
||||
$query = new \App\TermsFullQuery($dictionary,$term->string1,1,false);
|
||||
$result = $this->repoTerms->fetch($query);
|
||||
|
||||
$this->template->result = $result;
|
||||
$this->template->termFlags = $termFlags;
|
||||
|
||||
$this->setView('info');
|
||||
}
|
||||
|
||||
public function renderDefault()
|
||||
{
|
||||
}
|
||||
|
||||
public function actionIpa()
|
||||
{
|
||||
if ($this->getRequest()->isMethod('GET')) {
|
||||
if ($this->term) {
|
||||
$this['searchForm']['string']->setValue($this->term);
|
||||
$result = $this->doSearch('\\App\\TermsFullQuery',$this->slugs[$this->slug]->id,$this->term);
|
||||
if ($result) $this->template->result = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededIpa');
|
||||
}
|
||||
|
||||
public function actionInteractive()
|
||||
{
|
||||
if ($this->getRequest()->isMethod('GET')) {
|
||||
if ($this->term) {
|
||||
$this['searchForm']['string']->setValue($this->term);
|
||||
$result = $this->doSearch('\\App\\TermsFullQuery',$this->slugs[$this->slug]->id,$this->term);
|
||||
if ($result) $this->template->result = $result;
|
||||
}
|
||||
}
|
||||
|
||||
$this['searchForm']->onSuccess[] = array($this, 'searchFormSucceededInteractive');
|
||||
}
|
||||
|
||||
public function renderAutocomplete($whichData, $typedText = '',$translation = 1)
|
||||
{
|
||||
$translation = $this->repoTranslations->find($translation);
|
||||
|
||||
$query = new \App\TermsQuickQuery($translation->dictionary,$typedText,$translation->direction);
|
||||
$result = $this->repoTerms->fetch($query);
|
||||
|
||||
$map = [];
|
||||
foreach ($result as $str) {
|
||||
$map[] = $str["string1"];
|
||||
}
|
||||
|
||||
return $this->sendResponse(new JsonResponse($map));
|
||||
}
|
||||
|
||||
public function renderIpa()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function renderMerge()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user