Exercise/FOQElasticaBundle — Issue #49: Add custom configuration parameters
Author: kimausloos
Created: 2011-12-20 12:01:48+00:00
State: open

Hi,

I'm using ElasticaBundle to index the contents of pages through a custom model_to_elastica_transformer service in order to add computed fields that have no entry in the database (Entity class). For example:

From my configuration:
doctrine:
model_to_elastica_transformer:
service:
company_search.transformers.nodetransformer
mappings:
id:
title:
content: { handlerclass: Company\AdminNodeBundle\Entity\Node, handlermethod: getSearchContentForNode }

My transformer loops over the fields and gets the mapping definitions. If the field has no handlerclass/handlermethod parameter, the getter for that field is executed to fetch the contents of that field. If however there is a handlerclass/handlermethod, that gets called for the value of the field. Adding a getter for the content field in the entity would also solve this in theory but for various reasons it would not be good behaviour to solve this that way.

So in conclusion I would need to add the handlerclass and handlermethod as scalarNode entries to the configuration class. I've tried using FOQElastica as a parent and override, but since the call to the configuration class is inside the FOQElasticaExtension class it won't work. Overriding the FOQElasticaExtension class also seems impossible.