stanislav-web / Searcher

Database searcher for Phalcon Framework. This is the search service is designed to search multiple SQL tables. Convenient to use autocomplete, search documents, search the whole site.
http://reds.com
MIT License
25 stars 7 forks source link

getMetaData error #14

Open deepjyoti941 opened 8 years ago

deepjyoti941 commented 8 years ago

Hi got the following error

PHP Fatal error: Uncaught exception 'Phalcon\Mvc\Model\Exception' with message 'A dependency injector container is required to obtain the services related to the ORM' in phalcon/mvc/model/manager.zep:406\nStack trace:\n#0 [internal function]: Phalcon\Mvc\Model\Manager->_getConnection(Object(Library\App\Models\Product), NULL)\n#1 [internal function]: Phalcon\Mvc\Model\Manager->getReadConnection(Object(Library\App\Models\Product))\n#2 [internal function]: Phalcon\Mvc\Model->getReadConnection()\n#3 [internal function]: Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Library\App\Models\Product), Object(Phalcon\Di\FactoryDefault))\n#4 [internal function]: Phalcon\Mvc\Model\MetaData->_initialize(Object(Library\App\Models\Product), 'library\app\mod...', 'product', '')\n#5 [internal function]: Phalcon\Mvc\Model\MetaData->readMetaDataIndex(Object(Library\App\Models\Product), 0)\n#6 /var/www/html/anaohApi/vendor/stanislav-web/phalcon-searcher/src/Searcher/Validator.php(325): Phalcon\Mvc\Model\MetaData->getAttributes(Objec in phalcon/mvc/model/manager.zep on line 406, referer: http://192.168.43.148:3000/

my function

$query = $this->request->getQuery('q', 'string');
// create object instance
$searcher = new Searcher();

$searcher->setFields([
    'Library\App\Models\Product'    =>    [
        'title',
        'summary',
    ],
    'Library\App\Models\Jobs'    =>    [
        'title',
        'description'
    ]
])
->setQuery($query);

$result = $searcher->run();
Elenthar commented 8 years ago

I'm also having this problem. Maybe because of using Phalcon 2.0.x?