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

Fix create snapshots #1548

Merged
merged 1 commit into from
Aug 11, 2022
Merged

Fix create snapshots #1548

merged 1 commit into from
Aug 11, 2022

Conversation

jordisala1991
Copy link
Member

Subject

Broken only on 4.x due an update of phpstan with this copy paste typo.

@VincentLanglet
Copy link
Member

VincentLanglet commented Aug 11, 2022

Do you see an easy functional test to add ?

@jordisala1991
Copy link
Member Author

Does a functional test is possible ?

Not sure, my functional test for createsnapshotcommand didn't catch this bug.

Maybe a functional test if it is possible to create snapshots from the sonata admin interface.

@eerison
Copy link
Contributor

eerison commented Aug 11, 2022

Wait it's the same problem for cleanup snapshot: f8022f6#diff-112198c8b3816a6af7235c0c526ba39544d633700e4538d9ab1fc7e7c770d8f6R38

maybe we should revert the changed made there: #1536

@jordisala1991
Copy link
Member Author

Wait it's the same problem for cleanup snapshot: f8022f6#diff-112198c8b3816a6af7235c0c526ba39544d633700e4538d9ab1fc7e7c770d8f6R38

maybe we should revert the changed made there: #1536

NOpe, the problem is not the if, is the second condition changed from commit to beginTransaction, because I copy pasted. I double checked the other file, and I didn't make this error there.

@eerison
Copy link
Contributor

eerison commented Aug 11, 2022

Other thing I guess we should create a test to see if beginTransaction and commit are called
But what do you think we add this into the managerInterface? and use just

$this->snapshotManager->commit();

this way we could remove the couple from Doctrine methods and let the manager handle this!

in the end I'm proposing to follow the demeter law

@eerison
Copy link
Contributor

eerison commented Aug 11, 2022

Wait it's the same problem for cleanup snapshot: f8022f6#diff-112198c8b3816a6af7235c0c526ba39544d633700e4538d9ab1fc7e7c770d8f6R38
maybe we should revert the changed made there: #1536

NOpe, the problem is not the if, is the second condition changed from commit to beginTransaction, because I copy pasted. I double checked the other file, and I didn't make this error there.

True, it's using commit, then it could be other issue! ok good

@eerison eerison mentioned this pull request Aug 11, 2022
36 tasks
@eerison
Copy link
Contributor

eerison commented Aug 11, 2022

Other thing I guess we should create a test to see if beginTransaction and commit are called But what do you think we add this into the managerInterface? and use just

$this->snapshotManager->commit();

this way we could remove the couple from Doctrine methods and let the manager handle this!

in the end I'm proposing to follow the demeter law

in theory we should add here:

https://github.com/sonata-project/sonata-doctrine-extensions/blob/2.x/src/Model/ManagerInterface.php

or Add a new interface like ManagerTransactionInterface and add

commit and beginTransaction there and make SnapshotManagerInterface extends this class too

@VincentLanglet
Copy link
Member

Other thing I guess we should create a test to see if beginTransaction and commit are called But what do you think we add this into the managerInterface? and use just

$this->snapshotManager->commit();

this way we could remove the couple from Doctrine methods and let the manager handle this!

You're kinda creating coupling then.
Because not all managers are able to handle transaction.

It would be better to create a new interface here: https://github.com/sonata-project/sonata-doctrine-extensions/tree/2.x/src/Model

Which would be TransactionalManagerInterface with beginTransaction and commit.
Then the BaseEntityManager will implements it.

Do you want to do the PR @eerison ?

@eerison
Copy link
Contributor

eerison commented Aug 11, 2022

TransactionalManagerInterface

yeah it's the second option that I suggested 😄

But Yeah I can open a PR with TransactionalManagerInterface!

Create small interface are better! you are right ;)

@jordisala1991
Copy link
Member Author

But that change is independent from this fix right?

@eerison
Copy link
Contributor

eerison commented Aug 11, 2022

But that change is independent from this fix right?

well I can open a new PR improving this, and creating for test it!

@VincentLanglet VincentLanglet merged commit 3f33e83 into 4.x Aug 11, 2022
@VincentLanglet VincentLanglet deleted the jordisala1991-patch-1 branch August 11, 2022 08:49
@VincentLanglet
Copy link
Member

Let's merge this so far

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

Successfully merging this pull request may close these issues.

3 participants