FOSElasticaBundle icon indicating copy to clipboard operation
FOSElasticaBundle copied to clipboard

Get child object in FOSElasticaBundle symfony

Open k0v4back opened this issue 6 years ago • 1 comments

I want to get child object from my product.

Is it fos_elastica.yaml file

fos_elastica:
    clients:
        default: { host: elasticsearch, port: 9200 }
    indexes:
        photos:
            types:
                photo:
                    properties:
                        name: ~
                        sort: ~
                    _parent:
                        type: "product"
                        identifier: "id"
                    persistence:
                        driver: orm
                        model: App\Entity\Photo
                        provider: ~
                        finder: ~
        products:
            types:
                product:
                    properties:
                        title: ~
                        description: ~
                        created_at: ~
                    persistence:
                        driver: orm
                        model: App\Entity\Product
                        provider: ~
                        finder: ~

How to get child field 'name' from indexes photo inside product?

Please, show some example or give some link where I can to read about it.

k0v4back avatar Apr 22 '19 05:04 k0v4back

can you try this

        products:
            types:
                product:
                    properties:
                        title: ~
                        description: ~
                        created_at: ~
                        photo:
                            type: "object"
                            properties:
                                name: ~
                                sort: ~
                    persistence:
                        driver: orm
                        model: App\Entity\Product
                        provider: ~
                        finder: ~

NMathar avatar Oct 14 '19 14:10 NMathar