Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eefafc5

Browse filesBrowse files
committed
[DoctrineBridge] Don't use object IDs in DoctrineChoiceLoader when passing a value closure
1 parent 00763f6 commit eefafc5
Copy full SHA for eefafc5

File tree

2 files changed

+461
-1
lines changed
Filter options

2 files changed

+461
-1
lines changed

‎src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ public function loadValuesForChoices(array $choices, $value = null)
110110

111111
// Optimize performance for single-field identifiers. We already
112112
// know that the IDs are used as values
113+
$optimize = null === $value || is_array($value) && $value[0] === $this->idReader;
113114

114115
// Attention: This optimization does not check choices for existence
115-
if (!$this->choiceList && $this->idReader->isSingleId()) {
116+
if ($optimize && !$this->choiceList && $this->idReader->isSingleId()) {
116117
$values = array();
117118

118119
// Maintain order and indices of the given objects

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.