From 87b3f95d7525a755ad723a819d06ef96fec1e163 Mon Sep 17 00:00:00 2001 From: michal-borek Date: Thu, 18 Jan 2018 13:09:39 +0100 Subject: [PATCH] Fix for Spot2 ORM EntityPopulator In Spot2 you don't need to create getId methods for your entities and Faker requires from you to have such. Changing it like this will not force developer to create getId methods in Spot2 entity classes. --- src/Faker/ORM/Spot/EntityPopulator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {