Exercise/FOQElasticaBundle — pull request #107 by willdurand (2012-05-05 16:53:26+00:00)
Title: [Propel] Added new method to return a query to use in findByIdentifiers().

It's easy to create its own ElasticaToModelTransformer class by extending the existing one.
The main use case is to tweak the query to retrieve your model objects (to add join by default in order to reduce the number of queries for instance). So, most of the time you will override the `findByIdentifiers()` method, which seems fine but it's not!

The main issue is that you will have to copy/paste this method to override it because it contains more logic than a simple query. The aim of this PR is to add a new protected method to the default implementation (`createQuery()`) designed to be overrided.

```php
'id', 'hydrate' => true));
}

/**
* {@inheritdoc}
*/
protected function createQuery($class, $identifierField, array $identifierValues)
{
return PostQuery::create()
->joinWithTags()
->filterById($identifierValues)
;
}
}
```

As you can see, it's much better.

By the way, is there a reason to have `$class`, and `$identifierField` as arguments of the `findByIdentifiers()` method? I mean, these parameters are attributes, so we could avoid to pass them as arguments.