Bonjour,

Je cherche actuellement à mettre en place FOSElasticaBundle sur Symfony2, en utilisant Propel au lieu de Doctrine2.
Je me suis basé sur le tutoriel http://obtao.com/blog/2014/02/indexa...ch-et-symfony/ et j'ai tenté de l'adapter avec Propel.

fos_elastica.yml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
fos_elastica:
    clients:
        default: { host: %elastic_host%, port: %elastic_port% }
    indexes:
        my_search_1:
            client: default
            settings:
                index:
                    analysis:
                        analyzer:
                            custom_analyzer :
                              type     :    custom
                              tokenizer:    nGram
                              filter   :    [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
                            custom_search_analyzer :
                                type     :    custom
                                tokenizer:    standard
                                filter   :    [stopwords, asciifolding ,lowercase, snowball, elision, worddelimiter]
                        tokenizer:
                            nGram:
                                type:     nGram
                                min_gram: 2
                                max_gram: 20
                        filter:
                            snowball:
                                type:     snowball
                                language: French
                            elision:
                                type:     elision
                                articles: [l, m, t, qu, n, s, j, d]
                            stopwords:
                                type:      stop
                                stopwords: [_french_]
                                ignore_case : true
                            worddelimiter :
                                type:      word_delimiter
 
            types:
                article:
                    mappings:
                        id:
                            type: integer
                        createdAt :
                            type : date
                        publishedAt :
                            type : date
                        published :
                            type : boolean
                        title : ~
                        content : ~
                    # Propel doesn't support this feature yet.
                    persistence:
                        driver: propel
                        model: Acme\DemoBundle\Model\Article
                        #finder: ~
                        provider: ~
                        #listener: ~
schema.xml => Description du schéma de la base de données
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
<?xml version="1.0" encoding="UTF-8"?>
<database xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="default" namespace="Acme\DemoBundle\Model"
          package='src/Acme/DemoBundle/Model'
          defaultIdMethod="native"
          xsi:noNamespaceSchemaLocation="http://xsd.propelorm.org/1.6/database.xsd">
 
    <table name="article"
           description="Liste des articles">
        <column name="id" type="Integer" required="true" autoIncrement="true" primaryKey="true"/>
        <column name="created_at" type="Timestamp" required="true"/>
        <column name="published_at" type="Timestamp"/>
 
        <column name="title" type="varchar" size="250" />
        <column name="content" type="LongVarchar"/>
        <column name="published" type="boolean"/>
 
        <behavior name="timestampable">
            <parameter name="create_column" value="created_at"/>
            <parameter name="update_column" value="updated_at"/>
        </behavior>
    </table>
</database>

services.yml : Définition de mon form_type
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 
services:
    article_search_type:
        class: Acme\DemoBundle\Form\Type\ArticleSearchType
        arguments: []
        tags:
            -  { name: form.type }
        scope: request
ArticleController.php => Mon Controller
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
<?php
 
namespace Acme\DemoBundle\Controller;
 
use Acme\DemoBundle\Model\ArticleSearch;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Acme\DemoBundle\Form\Handler\ArticleSearchHandler;
 
class ArticleController extends Controller
{
    public function indexAction(Request $request)
    {
        $articleSearch = new ArticleSearch();
 
        $form = $this->createForm(
            $this->container->get('article_search_type'),
            $articleSearch
        );
 
        $formHandler = new ArticleSearchHandler(
            $form,
            $request,
            $this->container->get('fos_elastica.manager.propel')
        );
 
        exit;
        return $this->render(
            'AcmeDemoBundle:Article:index.html.twig',
            array(
            )
        );
    }
}
ArticleSearchType.php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
 
<?php
 
namespace Acme\DemoBundle\Form\Type;
 
use Acme\DemoBundle\Model\ArticleSearch;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
 
class ArticleSearchType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add(
                'title',
                null,
                array(
                    'required' => false,
                )
            )
            ->add(
                'dateFrom',
                'date',
                array(
                    'required' => false,
                    'widget'   => 'single_text',
                )
            )
            ->add(
                'dateTo',
                'date',
                array(
                    'required' => false,
                    'widget'   => 'single_text',
                )
            )
            ->add(
                'isPublished',
                'choice',
                array(
                    'choices'  => array('false' => 'non', 'true' => 'oui'),
                    'required' => false,
                )
            )
            ->add('search', 'submit');
    }
 
 
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        parent::setDefaultOptions($resolver);
        $resolver->setDefaults(
            array(
                // avoid to pass the csrf token in the url (but it's not protected anymore)
                'csrf_protection' => false,
                'data_class'      => 'Acme\DemoBundle\Model\ArticleSearch'
            )
        );
    }
 
 
    public function getName()
    {
        return 'article_search_type';
    }
}

Et lorsque j'appelle ma page j'ai le message d'erreur :
Catchable Fatal Error: Argument 1 passed to FOS\ElasticaBundle\Doctrine\RepositoryManager::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Common\Annotations\FileCacheReader given, called in /home/laurent/www/tests/sf2-elasticsearch/app/cache/dev/appDevDebugProjectContainer.php on line 1328 and defined in /home/laurent/www/tests/sf2-elasticsearch/vendor/friendsofsymfony/elastica-bundle/Doctrine/RepositoryManager.php line 21
500 Internal Server Error - ErrorException
Si on va dans le fichier propel.xml du elastica-bundle, on voit que le service appelle la classe RepositoryManager
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<service id="fos_elastica.manager.propel" class="FOS\ElasticaBundle\Doctrine\RepositoryManager">
            <argument type="service" id="annotation_reader"/>
</service>
Cette classe attend en 1er paramètre un Doctrine\Common\Persistence\ManagerRegistry d'où l'erreur.
Mais je ne vois pas comment la résoudre, quelqu'un aurait une idée ?

Merci d'avance