Currently when fetching meta data for an ODM entity the method createQuery() uses the getAllMetadata() methods from the MetadataFactory object and then opts to use the first key (0) as the mapping to be passed to the filter manager. However the first key doesn't necessarily hold the correct mapping data. For example if an entity extends an abstract class then the abstract class meta data will be returned. This leads to fieldMappings being absent from computation in the filter.
A good example is the typeCaseField method which uses a try/catch switch to determine the type, however when the entity extends other classes as per my example above, then the fieldMappings for the given field aren't necessarily in the meta data (for example they are only declared in the entity and not the extended classes).
I propose to use the getMetadataFor() methods of the metadataFactory class to fetch specific meta data for the given entity class.
Currently when fetching meta data for an ODM entity the method createQuery() uses the getAllMetadata() methods from the MetadataFactory object and then opts to use the first key (0) as the mapping to be passed to the filter manager. However the first key doesn't necessarily hold the correct mapping data. For example if an entity extends an abstract class then the abstract class meta data will be returned. This leads to fieldMappings being absent from computation in the filter.
A good example is the typeCaseField method which uses a try/catch switch to determine the type, however when the entity extends other classes as per my example above, then the fieldMappings for the given field aren't necessarily in the meta data (for example they are only declared in the entity and not the extended classes).
I propose to use the getMetadataFor() methods of the metadataFactory class to fetch specific meta data for the given entity class.
https://github.com/zfcampus/zf-doctrine-querybuilder/pull/29/files