Cannot find corresponding Doctrine objects

I’m using SF5 with the latest FosElastica bundle.

I have 2 entities with a OneToMany relation.

entity User 1 -> x Groups

my fos_elastica.yaml looks like:

fos_elastica:
    clients:
        default: { url: '%env(ELASTICSEARCH_URL)%' }
    indexes:
        test:
            use_alias: true
            types:
                users:
                    properties:
                        id: ~
                        email: ~
                        groups:
                            type: "nested"
                            include_in_parent: true
                            properties:
                                id: ~
                                name: ~
                    persistence:
                        driver: orm
                        model: AppEntityUser

When I populate the data I have:

{
"_index": "test_2020-03-23-081137",
"_type": "users",
"_id": "EtxyBnEBaS6kXWokfVYU",
"_version": 1,
"_score": 1,
"_source": {
"id": null,
"email": "somedata",
groups": [{
  'id': 1
  'name': 'Group name'
}]
}

When I make a Search I have the error

Cannot find corresponding Doctrine objects (0) for all Elastica results (4). Missing IDs: EtxyBnEBaS6kXWokfVYU

How should I configure my types with a OneToMany relation ?

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *