Skip to content
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

Transaction and their propagation management #1274

Closed
TheHett opened this issue Jan 4, 2021 · 8 comments
Closed

Transaction and their propagation management #1274

TheHett opened this issue Jan 4, 2021 · 8 comments

Comments

@TheHett
Copy link

TheHett commented Jan 4, 2021

The Symfony now uses one global entiry manager (or Document Manager for DoctrineODM, the essence is the same).
It leads to the troubles when we deal with long-lived demons (console applications). For excample we may want to clear UoW in some service, but this will affect other services. The application have one global registry and that's not good.

In the Spring Framework this problem is solved by using sessions and transaction propagation levels:
simple article https://www.baeldung.com/spring-transactional-propagation-isolation
full official documentation https://docs.spring.io/spring-framework/docs/4.2.x/spring-framework-reference/html/transaction.html#tx-propagation

It is worth noting that the Spring uses own individual Document Manager for each isolated transaction (session).

Have you considered adding a similar mechanism to the Symfony?
It would be very cool to be able to manage transactions and their propagation level through annotations.

PS: I doubted where I should place this proposal: here or in doctrine repo. I think that it is over repo level.

@stof
Copy link
Member

stof commented Jan 4, 2021

This is not something that can be added in DoctrineBundle itself, which is only about configuring the DBAL and ORM projects in a Symfony context. We cannot add this concept without support in the ORM.

@ostrolucky
Copy link
Member

DBAL 2.11 automatically handles lost connections doctrine/dbal#4119, what other issues with long lived demons you have? Anyways, as @stof pointed out, this would need to be added to dbal/orm.

@TheHett
Copy link
Author

TheHett commented Jan 4, 2021

DBAL 2.11 automatically handles lost connections doctrine/dbal#4119, what other issues with long lived demons you have? Anyways, as @stof pointed out, this would need to be added to dbal/orm.

@ostrolucky no, that's not what I was talking about

This is not something that can be added in DoctrineBundle itself, which is only about configuring the DBAL and ORM projects in a Symfony context. We cannot add this concept without support in the ORM.

@stof I suspect that this is not the level of doctrine. This is only concept how we should use Document Manager (more precisely, several DM's).

Сan anyone tell me which component should be responsible for this?

@ostrolucky
Copy link
Member

It's not clear what are you trying to do. You can use multiple entity managers without issues already. And spring documentation is not very clear either, you should do the work and explain what are you asking here better.

@TheHett
Copy link
Author

TheHett commented Jan 4, 2021

@ostrolucky the repositories are injected by higher layer and it do not offer a choice which DM should be used.
In default configuration provided by DoctrineBundle uses one global DM, is not it so?

It's not clear what are you trying to do

Doctrine made in the likeness JPA, but without transaction propagation management ability. Are you used original JPA?
I'm trying to understand why no one needs it.

@ostrolucky
Copy link
Member

@ostrolucky the repositories are injected by higher layer and it do not offer a choice which DM should be used.
In default configuration provided by DoctrineBundle uses one global DM, is not it so?

Keyword here is default. You specify your entity managers in your doctrine.yaml config and this configuration includes which entity is managed by which entity manager.

Are you used original JPA?

No, I didn't use it and I don't know what is transaction propagation management.

@TheHett
Copy link
Author

TheHett commented Jan 5, 2021

@ostrolucky
Sorry, but I'm afraid you don't have the competence to discuss this. You can close the ticket if there is no one here who understands this.

@ostrolucky
Copy link
Member

Since we are not smart enough to understand your requirements and you are not willing to explain them better, feel free to open the PR with your changes. In the meanwhile, I'm indeed closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants