oauth2-bundle
oauth2-bundle copied to clipboard
[Question] - Integrate with infrastructure layer other that doctrine.
Hi guys, first of all, great work here. 🎉
I've been going around the documentation and the code but I can't seem to find anywhere that indicates how to configure persistence in detail.
Is it possible to set up a different persistence mechanism other than doctrine/in_memory? If so, how would one proceed to do that?
Base config
# Only one persistence method can be configured at a time.
persistence: # Required
doctrine:
# Name of the entity manager that you wish to use for managing clients and tokens.
entity_manager: default
in_memory: ~
@jpmarques66 Hi, currently only these two persistence mechanism are supported out of the box. However, if you wish to use a different one, you should be able to implement it in your application.
@HypeMC Thanks for the answer! How would one do that? The only possible way that I'm seeing is implementing my own Doctrine Entity Manager and pass it here. Is this the only way, or am I missing something?
persistence:
doctrine:
entity_manager: MyEntityManager
Thanks in advance.
Well, implementing your own persistence mechanism doesn't seem like an easy task to do. As far as I see, the only two available methods are baked in (see the bundle extension):
switch ($persistenceMethod) {
case 'in_memory':
$loader->load('storage/in_memory.xml');
$this->configureInMemoryPersistence($container);
break;
case 'doctrine':
$loader->load('storage/doctrine.xml');
$this->configureDoctrinePersistence($container, $persistenceConfiguration);
break;
}
What I would suggest here is maybe centralize the persistence layer in one or several interfaces and add a service
persistence method that would accept one or several service IDs that would handle persistence. @jpmarques66, I'm not sure if this is any help but you might want to share your opinion as well.
Please also add documentation regarding the configuration in_memory
persistence mechanism.