-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto register doctrine services #303
base: master
Are you sure you want to change the base?
Conversation
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 |
f7baf9a
to
af0bdec
Compare
I rebased against master. I'll finish this one in the next few days |
if (null !== $metadata->addressGetter) { | ||
return true; | ||
} | ||
@trigger_error(sprintf('The class "%s" is deprecated and will be removed from a future version. Please remove it from your service definition.', self::class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trigger_error(sprintf('The class "%s" is deprecated and will be removed from a future version. Please remove it from your service definition.', self::class)); | |
@trigger_error(sprintf('The class "%s" is deprecated and will be removed in 6.0 version. Please use "%s".', self::class, GeocodeEntityListener::class)); |
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. |
This fixes #277
There are a few different aspects to this PR:
This is added with a new
provider
option on theGeocodable
class, which can be used to define a different provider for each entity:GeocoderListener
class in favor of a newGeocodeEntityListener
class.The reason for this is so that we can auto-register the
GeocodeEntityListener
class 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.ChainDriver
for metadata, where all the different metadata drivers are added (AttributeDriver
andAnnotationDriver
)This allows to quickly switch between using annotations to using attributes without needing to make any config or service changes