From 902683e75395aeaf3721993852f2a037fc1f03ea Mon Sep 17 00:00:00 2001 From: Oleg Voronkovich Date: Thu, 3 Jan 2019 17:59:38 +0300 Subject: [PATCH] Support populating Doctrine's immutable date types --- src/Faker/ORM/Doctrine/ColumnTypeGuesser.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php b/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php index 824f8c034a..bd608f9618 100644 --- a/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php +++ b/src/Faker/ORM/Doctrine/ColumnTypeGuesser.php @@ -67,6 +67,12 @@ public function guessFormat($fieldName, ClassMetadata $class) return function () use ($generator) { return $generator->datetime; }; + case 'datetime_immutable': + case 'date_immutable': + case 'time_immutable': + return function () use ($generator) { + return \DateTimeImmutable::createFromMutable($generator->datetime); + }; default: // no smart way to guess what the user expects here return null;