From 9e0b1a1f0687d92161c849d1a1b186e78733dd13 Mon Sep 17 00:00:00 2001 From: Maciej Malarz Date: Mon, 18 May 2020 21:38:37 +0200 Subject: [PATCH] Favour int over int_id --- lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php | 2 +- tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php b/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php index 200150253a..fbab8fb8ae 100644 --- a/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php @@ -1896,7 +1896,7 @@ public function mapField(array $mapping) : array if (! empty($this->generatorOptions['type'])) { $mapping['type'] = $this->generatorOptions['type']; } elseif (empty($mapping['type'])) { - $mapping['type'] = $this->generatorType === self::GENERATOR_TYPE_INCREMENT ? 'int_id' : 'custom_id'; + $mapping['type'] = $this->generatorType === self::GENERATOR_TYPE_INCREMENT ? Type::INT : Type::CUSTOMID; } } unset($this->generatorOptions['type']); diff --git a/tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php b/tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php index 8481900f69..529205fd83 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/UnitOfWorkTest.php @@ -539,7 +539,7 @@ class NotifyChangedDocument implements NotifyPropertyChanged { private $_listeners = []; - /** @ODM\Id(type="int_id", strategy="none") */ + /** @ODM\Id(type="int", strategy="none") */ private $id; /** @ODM\Field(type="string") */ @@ -611,7 +611,7 @@ protected function _onPropertyChanged($propName, $oldValue, $newValue) /** @ODM\Document */ class NotifyChangedRelatedItem { - /** @ODM\Id(type="int_id", strategy="none") */ + /** @ODM\Id(type="int", strategy="none") */ private $id; /** @ODM\ReferenceOne(targetDocument=NotifyChangedDocument::class) */