Search code examples
phpsearchsymfony-2.3symfony-cmfdoctrine-phpcr

Symfony 2 - Symfony CMF SearchBundle installation


I'm trying to install Symfony CMF SearchBundle over a clean Symfony 2.3 but the installation instructions are quite incomplete. It seems like it has some dependencies that needs to be added manually in composer.json. After hours I got to this:

"jackalope/jackalope-doctrine-dbal": "1.1.2",
"jackalope/jackalope": "1.1.7",
"doctrine/phpcr-odm": "1.2.*",
"doctrine/phpcr-bundle": "1.2.*",
"symfony-cmf/routing-bundle": "1.3.3",
"symfony-cmf/search-bundle": "1.1.1"

Also in AppKernel.php I added this bundles:

new Liip\SearchBundle\LiipSearchBundle(),
new Symfony\Cmf\Bundle\SearchBundle\CmfSearchBundle(),
new Symfony\Cmf\Bundle\RoutingBundle\CmfRoutingBundle(),
new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),

Yet, still I'm unable to make it work. I'm getting this:

ServiceNotFoundException: The service "cmf_search.phpcr_controller" has a dependency on a non-existent service "cmf_routing.dynamic_router".

And here is where I'm stuck.

Has anybody successfully installed the SearchBundle and maybe can give me some guidelines? Right now I'm feeling like I'm trying to use this bundle for something that it wasn't supposed to. All I need is a bundle that can help me quickly set up a search over some entities. Am I doing it wrong?


Solution

  • What exactly do you want to do? Do you want to search in a doctrine orm? Then this bundle is not ready for you.

    Right now, all it supports is searching in Doctrine PHPCR-ODM databases for documents that implement the RouteReferrersReadInterface from the CmfRoutingBundle (this might be something interesting for you in general, if you have entities that have a URL associated). If your entities can implement that interface, it should be fairly simple to add support for that - if this is the case please open an issue in CmfSearchBundle to get some help.

    If your entities have nothing to do with the CMF, i recommend that you look at the 2.0 version of LiipSearchBundle and add your own search service. The main part is that you need to generate a URL for your entities and extract the title and description from them.