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

Make EntityPersisters tell the UoW about post insert IDs early #10743

Merged
merged 1 commit into from
Jun 25, 2023

Conversation

mpdude
Copy link
Contributor

@mpdude mpdude commented Jun 2, 2023

This refactoring does two things:

Reviewers: Is the way I implemented the deprecation that EntityPersisters shall no longer return these arrays and change their return type to void ok?

}

/** @group DDC-3470 */
public function testExecuteInsertsWillReturnEmptySetWithNoQueuedInserts(): void
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the only test in here, and it is now meaningless.

@greg0ire
Copy link
Member

Reviewers: Is the way I implemented the deprecation that EntityPersisters shall no longer return these arrays and change their return type to void ok?

I don't see anything wrong with that. Please document the deprecation though.

@mpdude mpdude force-pushed the post-insert-id-early branch from eda87a1 to 71755bf Compare June 21, 2023 18:11
@mpdude
Copy link
Contributor Author

mpdude commented Jun 21, 2023

Added the deprecation in the UPGRADE file

@mpdude mpdude force-pushed the post-insert-id-early branch 4 times, most recently from 2201af3 to f93004c Compare June 21, 2023 18:15
@greg0ire greg0ire self-requested a review June 21, 2023 18:57
lib/Doctrine/ORM/Persisters/Entity/EntityPersister.php Outdated Show resolved Hide resolved
* @param object $entity
* @param mixed $generatedId
*/
public function assignPostInsertId($entity, $generatedId): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this method be final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO the entire UoW should be final :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if technically it is not, we should treat it as if it were 😈

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

This refactoring does two things:

* We can avoid collecting the post insert IDs in a cumbersome array structure that will be returned by the EntityPersisters and processed by the UoW right after. Instead, use a more expressive API: Make the EntityPersisters tell the UoW about the IDs immediately.
* IDs will be available in inserted entities a tad sooner. That may help to resolve doctrine#10735, where we can use the IDs to skip extra updates.
@mpdude mpdude force-pushed the post-insert-id-early branch from f93004c to 8bc74c6 Compare June 23, 2023 07:08
@greg0ire greg0ire added this to the 2.16.0 milestone Jun 25, 2023
@greg0ire greg0ire merged commit 7ef4afc into doctrine:2.16.x Jun 25, 2023
@greg0ire
Copy link
Member

Thanks @mpdude !

@mpdude mpdude deleted the post-insert-id-early branch June 25, 2023 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants