Permalink
Browse files

Allow for falsey, non-null identifiers in persistNew()

  • Loading branch information...
jmikola committed Jan 14, 2014
1 parent cc422e4 commit dad59aa1109ceea6bfff3756c6b7b3341267ae3d
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/Doctrine/ODM/MongoDB/UnitOfWork.php
@@ -954,7 +954,7 @@ private function persistNew($class, $document)
$idValue = $class->getIdentifierValue($document);
$upsert = $idValue !== null;
- if ($class->generatorType !== ClassMetadata::GENERATOR_TYPE_NONE && ! $idValue) {
+ if ($class->generatorType !== ClassMetadata::GENERATOR_TYPE_NONE && $idValue === null) {
$idValue = $class->idGenerator->generate($this->dm, $document);
$idValue = $class->getPHPIdentifierValue($class->getDatabaseIdentifierValue($idValue));
$class->setIdentifierValue($document, $idValue);

0 comments on commit dad59aa

Please sign in to comment.