Skip to content

Commit

Permalink
Prevent IdGenerator from decorating itself (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
bricejulia authored Jan 9, 2021
1 parent d4e57d3 commit c35eec1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Bridge/Doctrine/Persister/ObjectManagerPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function persist($object)
// Check if the ID is explicitly set by the user. To avoid the ID to be overridden by the ID generator
// registered, we disable it for that specific object.
if ($metadata instanceof ORMClassMetadataInfo) {
if ($metadata->usesIdGenerator() && false === empty($metadata->getIdentifierValues($object))) {
if ($metadata->usesIdGenerator() && 0 !== count($metadata->getIdentifierValues($object)) && !$metadata->idGenerator instanceof IdGenerator) {
$metadata = $this->configureIdGenerator($metadata);
}
} else if ($metadata instanceof ODMClassMetadataInfo) {
Expand Down

0 comments on commit c35eec1

Please sign in to comment.