8000 bug #9557 [DoctrineBridge] Fix for cache-key conflict when having a \… · symfony/symfony@be01e34 · GitHub
[go: up one dir, main page]

Skip to content

Commit be01e34

Browse files
committed
bug #9557 [DoctrineBridge] Fix for cache-key conflict when having a \Traversable as choices (DRvanR)
This PR was submitted for the 2.3-dev branch but it was merged into the 2.3 branch instead (closes #9557). Discussion ---------- [DoctrineBridge] Fix for cache-key conflict when having a \Traversable as choices | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #9556 | License | MIT | Doc PR | ~ Commits ------- 1119684 Fix for cache-key conflict when having a \Traversable as choices
2 parents 28e9e06 + d6163a8 commit be01e34

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
8989
array_walk_recursive($choiceHashes, function (&$value) {
9090
$value = spl_object_hash($value);
9191
});
92+
} elseif ($choiceHashes instanceof \Traversable) {
93+
$hashes = array();
94+
foreach ($choiceHashes as $value) {
95+
$hashes[] = spl_object_hash($value);
96+
}
97+
98+
$choiceHashes = $hashes;
9299
}
93100

94101
$preferredChoiceHashes = $options['preferred_choices'];

0 commit comments

Comments
 (0)
0