cakephp / elastic-search

Elastic search datasource for CakePHP
Other
88 stars 53 forks source link

Pagination Unknown method "alias" #135

Closed cnizzardini closed 7 years ago

cnizzardini commented 7 years ago

Should I be able to use the PaginatorComponent with Elastic Search the same as if using Cake\ORM\Query? I have a plugin, YummySearch, that I'd like to work with ES as well but it requires using Cake\ORM\Query.

Error: Unknown method "alias"

Code

$Errors = TypeRegistry::get('Errors');
$query = $Errors->find();
$errorLog = $this->paginate($query);

Trace

⟩ Cake\ElasticSearch\Query->__call
CORE/src/Controller/Component/PaginatorComponent.php, line 174
⟩ Cake\ElasticSearch\Query->alias
CORE/src/Controller/Component/PaginatorComponent.php, line 174
⟩ Cake\Controller\Component\PaginatorComponent->paginate
CORE/src/Controller/Controller.php, line 717
⟩ Cake\Controller\Controller->paginate
ROOT/plugins/Admin/src/Controller/ErrorLogController.php, line 39
⟩ Admin\Controller\ErrorLogController->index
CORE/src/Controller/Controller.php, line 440
⟩ Cake\Controller\Controller->invokeAction
CORE/src/Http/ActionDispatcher.php, line 119
⟩ Cake\Http\ActionDispatcher->_invoke
CORE/src/Http/ActionDispatcher.php, line 93
⟩ Cake\Http\ActionDispatcher->dispatch
CORE/src/Routing/Dispatcher.php, line 60
⟩ Cake\Routing\Dispatcher->dispatch
ROOT/webroot/index.php, line 37

My System CakePHP 3.4.13 CakePHP/elastic-search 0.3.5 PHP Version 5.6.30-11+deb.sury.org~xenial+3 Ubuntu 16.04

Edit: Does this answer my question?

This is a pre-alpha version of an alternative ORM for CakePHP 3.0

markstory commented 7 years ago

Pagination is not yet fully functional for ElasticSearch in the master branch. You might want to try the 1.0 branch instead.

markstory commented 7 years ago

Related to #86.

cnizzardini commented 7 years ago

Hey thanks. Changing from stable to 1.0.x-dev in composer did the trick.

lorenzo commented 7 years ago

@cnizzardini I just recently released version 1.0.0, your na use in your composer file ^1.0 instead of the branch