diff --git a/src/Faker/ORM/Spot/EntityPopulator.php b/src/Faker/ORM/Spot/EntityPopulator.php index d2d6d8a1cc..ba5bddb5a4 100644 --- a/src/Faker/ORM/Spot/EntityPopulator.php +++ b/src/Faker/ORM/Spot/EntityPopulator.php @@ -151,7 +151,7 @@ public function guessColumnFormatters(Generator $generator) $formatters[$fieldName] = function ($inserted) use ($required, $entityName, $locator) { if (!empty($inserted[$entityName])) { - return $inserted[$entityName][mt_rand(0, count($inserted[$entityName]) - 1)]->getId(); + return $inserted[$entityName][mt_rand(0, count($inserted[$entityName]) - 1)]->get('id'); } if ($required && $this->useExistingData) {