Auto register doctrine services
This fixes #277
There are a few different aspects to this PR:
- This includes the changes in #302
- Add support to define the provider per entity
This is added with a new
provideroption on theGeocodableclass, which can be used to define a different provider for each entity:
#[Geocodable(povider: 'foo')]
class User {}
#[Geocodable(povider: 'bar')]
class DifferentUser {}
- This deprecates the
GeocoderListenerclass in favor of a newGeocodeEntityListenerclass. The reason for this is so that we can auto-register theGeocodeEntityListenerclass when Doctrine is available, and automatically have a lookup for each provider. All the different providers are added to a service-locator, which is then used to look up the provider for an entity in the listener. - Add a new
ChainDriverfor metadata, where all the different metadata drivers are added (AttributeDriverandAnnotationDriver) This allows to quickly switch between using annotations to using attributes without needing to make any config or service changes
Many thanks :) I'd also an option to disable listener (because personally I don't use it)
Don't forget to fix conflicts ;)
Also listener test class should be renamed probably
I rebased against master. I'll finish this one in the next few days
An example with Geocodable attribute and using provider would be good to add in readme
Friendly ping :)
@norkunas Sorry for not getting to this earlier, other projects kept me very busy. I'll only be able to finish this by next week.