You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -68,36 +69,23 @@ protected function doLoadValuesForChoices(array $choices): array
68
69
// know that the IDs are used as values
69
70
// Attention: This optimization does not check choices for existence
70
71
if ($this->idReader) {
71
-
trigger_deprecation('symfony/doctrine-bridge', '5.1', 'Not defining explicitly the IdReader as value callback when query can be optimized is deprecated. Don\'t pass the IdReader to "%s" or define the "choice_value" option instead.', __CLASS__);
72
-
// Maintain order and indices of the given objects
trigger_deprecation('symfony/doctrine-bridge', '5.1', 'Not defining explicitly the IdReader as value callback when query can be optimized is deprecated. Don\'t pass the IdReader to "%s" or define the "choice_value" option instead.', __CLASS__);
80
+
if ($this->idReader && null === $value) {
81
+
thrownewLogicException('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
92
82
}
93
83
94
84
$idReader = null;
95
85
if (\is_array($value) && $value[0] instanceof IdReader) {
$this->expectDeprecation('Since symfony/doctrine-bridge 5.1: Not defining explicitly the IdReader as value callback when query can be optimized is deprecated. Don\'t pass the IdReader to "Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader" or define the "choice_value" option instead.');
197
+
$this->expectException(LogicException::class);
198
+
$this->expectExceptionMessage('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
199
+
200
200
$loader = newDoctrineChoiceLoader(
201
201
$this->om,
202
202
$this->class,
@@ -293,12 +293,11 @@ public function testLoadChoicesForValuesDoesNotLoadIfEmptyValues()
$this->expectDeprecation('Since symfony/doctrine-bridge 5.1: Not defining explicitly the IdReader as value callback when query can be optimized is deprecated. Don\'t pass the IdReader to "Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader" or define the "choice_value" option instead.');
298
+
$this->expectException(LogicException::class);
299
+
$this->expectExceptionMessage('Not defining the IdReader explicitly as a value callback when the query can be optimized is not supported.');
300
+
302
301
$loader = newDoctrineChoiceLoader(
303
302
$this->om,
304
303
$this->class,
@@ -315,17 +314,8 @@ public function testLegacyLoadChoicesForValuesLoadsOnlyChoicesIfValueUseIdReader
0 commit comments