Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fatal error: Call to undefined method #49

Open
Doopin opened this issue Dec 12, 2016 · 15 comments
Open

Fatal error: Call to undefined method #49

Doopin opened this issue Dec 12, 2016 · 15 comments
Labels

Comments

@Doopin
Copy link

Doopin commented Dec 12, 2016

I have just downloaded this module and I installed it.
But I can work with it because of this fatal error in the screenshot.
I actually use Zend 2.4.9.
What have I missed please?

Here is my code
use SphinxSearch\Search;
use SphinxSearch\Db\Sql\Predicate\Match;

$search = new Search($adapter);
$rowset = $search->search('foo', new Match('?', 'ipsum dolor'));

echo 'Founds row:' . PHP_EOL;
foreach ($rowset as $row) {
echo $row['id'] . PHP_EOL;
}

op

@leogr
Copy link
Contributor

leogr commented Dec 12, 2016

Which PHP version are you using?

@Doopin
Copy link
Author

Doopin commented Dec 12, 2016

I use PHP 5.6

@leogr leogr added the bug label Dec 13, 2016
@leogr
Copy link
Contributor

leogr commented Dec 13, 2016

It seems an issue related to the specific zend-db version, we can't reproduce currently.
We need further investigation.

Could you try your example with another version?

Or could you provide us a full reproducible example of the issue (i.e. source code, composer.json etc..), please?

Thanks in advance.

@Doopin
Copy link
Author

Doopin commented Dec 14, 2016

It seems this processWithinGroupOrder() method has been removed from SelectDecorator class in Zend Framework 2.4.9
I can't find it in SelectDecorator nor Select and AbstractPreparableSql and AbstractSql classes

However I found this processWithinGroupOrder() method in SphinxSearch\Db\Sql\Select.

Here is my sample code
`<?php
namespace AppSearch\Controller;

use App\Controller\AppAbstractActionController;

use SphinxSearch\Search;
use SphinxSearch\Db\Sql\Predicate\Match;

class IndexController extends AppAbstractActionController {

public function indexAction() {
    $isIndexPage = false;
    
    $search = new Search($this->getDbAdapter());
    $rowset = $search->search('doopins', new Match('?', 'ipsum dolor'));

    echo 'Founds row:' . PHP_EOL;
    foreach ($rowset as $row) {
        echo $row['id'] . PHP_EOL;
    }
    
    \Zend\Debug\Debug::dump($rowset); exit;
    
    return [
        'isIndexPage' => $isIndexPage
    ];
}

}`

@leogr
Copy link
Contributor

leogr commented Dec 14, 2016

Could you attach your composer.json too?

I suppose you're using the zend-db 2.4.8 (because 2.4.9 is the zend framework version, but the zend-db 2.4.9 does not exist).
Actually, process* methods are called by zend-db itself (composing the method name in Zend\Db\Sql\AbstractSql, so I'm not sure if the issue is within the zend-db itself OR is an incompatibility with our library.

@Doopin
Copy link
Author

Doopin commented Dec 14, 2016

Sure!
The attached file is the composer.json file renamed to composer.txt

composer.txt

@Doopin
Copy link
Author

Doopin commented Dec 14, 2016

However if you need more infos, you can have them here on Github in Zend framework repository.
Due to a bug in Version 2.2.3 in the past I have downloaded manually the 2.4.9 release zip file and replace my old library folder.
So you can go on ZF2 repository the release 2.4.9 to better explore Classes

@leogr leogr closed this as completed May 3, 2017
@DSCmattb
Copy link

DSCmattb commented Jun 1, 2017

This is also an issue for me.. Using PHP 7.0.18 with any version of zend 2.4

@leogr
Copy link
Contributor

leogr commented Jun 1, 2017

I closed the issue because I had thought it was resolved, sorry.

Could you provide us more detail?
I need some some code to reproduce the issue (provide composer.json and composer.lock too, please), then I'll work on it ASAP.

@leogr leogr reopened this Jun 1, 2017
@DSCmattb
Copy link

DSCmattb commented Jun 1, 2017

No problems mate,
This is the received error:

http://puu.sh/w7xPB/dacc6e7e92.png

Attached is the files requested

composer.txt
composer_lock.txt

The following code is used:

$this->getSphinx()->search('upload', new Match('?', '123'));

public function getSphinx() { if (!$this->sphinx) { $sm = $this->getServiceLocator()->get('Config'); $adapter = new \Zend\Db\Adapter\Adapter($sm["sphinxql"]); $this->sphinx = new Search($adapter); } return $this->sphinx; }
Apologises for the weird formatting that github places on the code

@leogr
Copy link
Contributor

leogr commented Jun 1, 2017

@DSCmattb I see you used \Zend\Db\Adapter\Adapter directly, but this library cannot work in that way.
This library requires a custom configuration for Zend\Db\Adapter\Adapater that's provided by the included adapter service factory (config documentation here).

Could you try your code with our service factory instead of $adapter = new \Zend\Db\Adapter\Adapter($sm["sphinxql"]) and then let me a feedback?

Thanks in advance!

@DSCmattb
Copy link

DSCmattb commented Jun 1, 2017

Can agree, defining it as the documentation works perfectly, sorry for that 👍

@leogr
Copy link
Contributor

leogr commented Jun 5, 2017

@DSCmattb no problem, may be we need to improve docs in order to make the service factory requirement more clear 👍

I'll do that prior to close this issue.

Finally, I'd like to ask to @Doopin if the issue could be marked as solved, isn't it?

@Doopin
Copy link
Author

Doopin commented Jun 6, 2017

@leogr we can close this issue.
Due to a deadline for my application, I had to switch to another search engine solution and it doesn't require this module anymore.
I'm sorry but I can't test any of above solutions since sphinx has been removed from my workspace.
Thank you.

@leogr
Copy link
Contributor

leogr commented Jun 6, 2017

Ok, no problem!
Thank you for your feedback.

leogr added a commit that referenced this issue Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants