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

Use the correct types for generated ids #6152

Merged
merged 2 commits into from
Nov 27, 2016

Conversation

lcobucci
Copy link
Member

This merges #5935 and #6020 in order to solve #5684.

@@ -890,7 +887,14 @@ private function persistNew($class, $entity)
$idValue = $idGen->generate($this->em, $entity);

if ( ! $idGen instanceof \Doctrine\ORM\Id\AssignedGenerator) {
$idValue = array($class->identifier[0] => $idValue);
$idField = $class->identifier[0];
Copy link
Member

Choose a reason for hiding this comment

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

I just digged into this conversion in depth, and it seems wrong. The AssignedGenerator already uses a PHP value internally, and never produces an SQL value. This code can therefore be dropped, and test code needs to be re-validated

Copy link
Member

Choose a reason for hiding this comment

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

Nvm, applies to non-assigned generators -.- Misread the ! in front of it.

Copy link
Member Author

Choose a reason for hiding this comment

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

But then it's a bit confusing... should this conversion be generators' responsibility?

Copy link
Member

Choose a reason for hiding this comment

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

Could be, but can't refactor it now, since generators have very little access to external scope.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it 😉

@Ocramius Ocramius self-assigned this Nov 27, 2016
@Ocramius Ocramius merged commit 0a86c32 into doctrine:master Nov 27, 2016
Ocramius added a commit that referenced this pull request Nov 27, 2016
Ocramius added a commit that referenced this pull request Nov 27, 2016
@Ocramius
Copy link
Member

@lcobucci merged and closed all related issues, thanks a lot!

Note: I added a few additional commits to just extract the common code.

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.

4 participants