Skip to content

Commit

Permalink
minor(make:factory): default false for embedded and `targetDocument…
Browse files Browse the repository at this point in the history
…` mappings (#602)

When an ODM reference is configured, the 'embedded' key may not be
present at all in the association mapping. The missing key should be
treated as implicit false. Without this the make:factory command will
crash.
  • Loading branch information
melkamar authored May 12, 2024
1 parent c68fee1 commit 431afa3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/Bundle/Maker/Factory/ODMDefaultPropertiesGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public function __invoke(SymfonyStyle $io, MakeFactoryData $makeFactoryData, Mak
}

foreach ($metadata->associationMappings as $item) {
/** @phpstan-ignore-next-line */
if (!$item['embedded'] || !$item['targetDocument']) {
if (!($item['embedded'] ?? false) || !($item['targetDocument'] ?? false)) {
// foundry does not support ODM references
continue;
}
Expand Down

0 comments on commit 431afa3

Please sign in to comment.