繁体   English   中英

EWZ_SEARCH捆绑包Symfony Jobeet 2.3到2.8的上下文帮助升级

[英]Context Help for EWZ_SEARCH bundle Symfony Jobeet 2.3 to 2.8 upgrade

前一段时间,我完成了这一系列教程,并将Jobeet从symfony 1转换为symfony 2。

http://intelligentbee.com/blog/2013/08/07/symfony2-jobeet-day-1-starting-up-the-project/

我现在正尝试将其升级到2.8

除进行lucene搜索外,其他所有操作均有效。

我正在尝试实现EWZSearchBundle作为解决方案。

config.yml

ewz_search:
    indices:
        indexJob:
            path:                 %kernel.root_dir%/EwzLuceneIndices/%kernel.environment%/myIndexJob
            analyzer:             Zend\Search\Lucene\Analysis\Analyzer\Common\Utf8\CaseInsensitive

    # deprecated
    analyzer:             Zend\Search\Lucene\Analysis\Analyzer\Common\TextNum\CaseInsensitive
    path:                 %kernel.root_dir%/cache/%kernel.environment%/lucene/index        

控制器中的搜索动作

public function searchAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $query = $this->getRequest()->get('query');

        if(!$query) {
            if(!$request->isXmlHttpRequest()) {
                return $this->redirect($this->generateUrl('ibw_job'));
            } else {
                return new Response('No results.');
            }
        }

        $jobs = $em->getRepository('AcmeJobeetBundle:Job')->getForLuceneQuery($query);

        if($request->isXmlHttpRequest()) {
            if('*' == $query || !$jobs || $query == '') {
                return new Response('No results.');
            }

            return $this->render('AcmeJobeetBundle:Job:list.html.twig', array('jobs' => $jobs));
        }

    }

实体存储库中的功能

 static public function getLuceneIndex()
    {
       $luceneSearchForFooIndex = $this->get('ewz_search.lucene.manager')->getIndex('indexJob');

        return $luceneSearchForFooIndex ;
    }

我在app_dev.php中得到的错误

 Error: Using $this when not in object context
500 Internal Server Error - FatalErrorException 

我知道“ $ this”不在上下文中,这就是为什么我收到错误,但对于如何解决它我绝对没有id。

任何帮助/链接到文档/想法的解决方案,不胜感激。

提前致谢。

作曲家拯救了这一天

     "sonata-project/doctrine-orm-admin-bundle": "2.3.*",
     "zf1/zend-search-lucene": "~1.12"

经过一天左右的尝试使其他搜索功能正常工作。 我可以通过composer添加特定的框架组件来进行zend框架的工作。

现在都可以在2.8中使用了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM