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

[Sortable] Updating SortableGroup for multiple entities in one flush #2618

Open
hafkenscheid opened this issue May 7, 2023 · 2 comments
Open
Labels
Sortable Still Relevant Mark PRs that might've been auto-closed that are still relevant.

Comments

@hafkenscheid
Copy link

Environment

Package

show

$ composer show --latest gedmo/doctrine-extensions
v3.11.1

PHP version

$ php -v
8.0.13

Subject

Probably related to #824

Case: If the SortableGroup of multiple items is updated at the same time, the SortablePosition of those items will be 0 for every item.

Steps to reproduce

Using the test entities Paper and Author.

Starting with data:

Author Name Paper Position
Author 1 Paper A 0
Author 2 Paper A 1
Author 3 Paper A 2
Author 4 Paper A 3
Author 5 Paper A 4
Author 6 Paper A 5
null Paper B 0

Then updating the author for Paper B. (i.e. $paper->addAuthor('Author 4'), $paper->addAuthor('Author 5') and $paper->addAuthor('Author 6'), followed by a flush()).

Expected results

Author Name Paper Position
Author 1 Paper A 0
Author 2 Paper A 1
Author 3 Paper A 2
Author 4 Paper B 0
Author 5 Paper B 1
Author 6 Paper B 2

Actual results

Author Name Paper Position
Author 1 Paper A 0
Author 2 Paper A 1
Author 3 Paper A 2
Author 4 Paper B 0
Author 5 Paper B 0
Author 6 Paper B 0

So, the position for every author on paper B is now 0, so it lost its sequence.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Dec 16, 2023
@hafkenscheid
Copy link
Author

This is still an issue

@franmomu franmomu added Still Relevant Mark PRs that might've been auto-closed that are still relevant. and removed Stale labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sortable Still Relevant Mark PRs that might've been auto-closed that are still relevant.
Projects
None yet
Development

No branches or pull requests

3 participants