From 9ba8901934a65f727bb6ca4b1ccc26cfeae53b52 Mon Sep 17 00:00:00 2001 From: Jason Gessner Date: Sat, 5 Mar 2022 19:05:47 -0600 Subject: [PATCH] Process foreign keys before optional fields to fix dependency order. --- src/AppBundle/Command/ImportStdCommand.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/AppBundle/Command/ImportStdCommand.php b/src/AppBundle/Command/ImportStdCommand.php index e98e1766..704e577d 100755 --- a/src/AppBundle/Command/ImportStdCommand.php +++ b/src/AppBundle/Command/ImportStdCommand.php @@ -569,10 +569,6 @@ protected function getEntityFromData(string $entityName, array $data, array $man $this->copyKeyToEntity($entity, $entityName, $data, $key, true); } - foreach ($optionalKeys as $key) { - $this->copyKeyToEntity($entity, $entityName, $data, $key, false); - } - foreach ($foreignKeys as $key) { $foreignEntityShortName = ucfirst(str_replace('_code', '', $key)); @@ -601,6 +597,10 @@ protected function getEntityFromData(string $entityName, array $data, array $man } } + foreach ($optionalKeys as $key) { + $this->copyKeyToEntity($entity, $entityName, $data, $key, false); + } + // special case for Card if ($entity instanceof Card) { // calling a function whose name depends on the type_code