FOSElasticaBundle icon indicating copy to clipboard operation
FOSElasticaBundle copied to clipboard

[question] indexable_callback for level 2 entities

Open GGTT2 opened this issue 5 years ago • 0 comments

Hello,

Let's say, I have a "book" and an "author" entity;

Then entity book has a getPublic() method that that returns "true" if the book is public. In the mapping config I use

 book:
            types:
                book:
                    indexable_callback: 'getPublic'

And indeed, it only indexes books that have their getPublic() == true :+1: Lets say I have a book with "title":"toto" and "public":false, it is not indexed.

Now, I also have an class "author" with an n-to-n relationship with books. The mapping are made so that when I index author, I get this

"author":{
    "name":"titi",
    "books":[{
        "title": "toto",
        "public": false
    }]
}

The problem is: the callback "getPublic" is well triggered for 1st level indexation, and was not called with this "second level". Is it normal? And if yes, what would be a workaround? Thanks!!

GGTT2 avatar Mar 25 '20 13:03 GGTT2