Skip to content

Commit f42d6d9

Browse files
Merge branch '4.4' into 5.0
* 4.4: [DI] auto-register singly implemented interfaces by default [DI] fix overriding existing services with aliases for singly-implemented interfaces remove service when base class is missing do not depend on the QueryBuilder from the ORM [Security/Http] call auth listeners/guards eagerly when they "support" the request [Messenger] add tests to FailedMessagesShowCommand Fix the translation commands when a template contains a syntax error [Security] Fix clearing remember-me cookie after deauthentication [Validator] Update Slovenian translations [HttpClient] remove conflict rule with HttpKernel that prevents using the component in Symfony 3.4 [Config][ReflectionClassResource] Handle parameters with undefined constant as their default values fix dumping number-like string parameters Fix CI [Console] Fix autocomplete multibyte input support [Config] don't break on virtual stack frames in ClassExistenceResource more robust initialization from request Changing the multipart form-data behavior to use the form name as an array, which makes it recognizable as an array by PHP on the $_POST globals once it is coming from the HttpClient component
2 parents 11f030a + dc27deb commit f42d6d9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Form/Type/DoctrineType.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Doctrine\Common\Collections\Collection;
1515
use Doctrine\Common\Persistence\ManagerRegistry;
1616
use Doctrine\Common\Persistence\ObjectManager;
17-
use Doctrine\ORM\QueryBuilder;
1817
use Symfony\Bridge\Doctrine\Form\ChoiceList\DoctrineChoiceLoader;
1918
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
2019
use Symfony\Bridge\Doctrine\Form\ChoiceList\IdReader;
@@ -82,13 +81,16 @@ public static function createChoiceName(object $choice, $key, string $value): st
8281
* For instance in ORM two query builders with an equal SQL string and
8382
* equal parameters are considered to be equal.
8483
*
84+
* @param object $queryBuilder A query builder, type declaration is not present here as there
85+
* is no common base class for the different implementations
86+
*
8587
* @return array|null Array with important QueryBuilder parts or null if
8688
* they can't be determined
8789
*
8890
* @internal This method is public to be usable as callback. It should not
8991
* be used in user code.
9092
*/
91-
public function getQueryBuilderPartsForCachingHash(QueryBuilder $queryBuilder): ?array
93+
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
9294
{
9395
return null;
9496
}

Form/Type/EntityType.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public function configureOptions(OptionsResolver $resolver)
5050
*/
5151
public function getLoader(ObjectManager $manager, QueryBuilder $queryBuilder, string $class)
5252
{
53+
if (!$queryBuilder instanceof QueryBuilder) {
54+
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
55+
}
56+
5357
return new ORMQueryBuilderLoader($queryBuilder);
5458
}
5559

@@ -65,11 +69,17 @@ public function getBlockPrefix()
6569
* We consider two query builders with an equal SQL string and
6670
* equal parameters to be equal.
6771
*
72+
* @param QueryBuilder $queryBuilder
73+
*
6874
* @internal This method is public to be usable as callback. It should not
6975
* be used in user code.
7076
*/
71-
public function getQueryBuilderPartsForCachingHash(QueryBuilder $queryBuilder): ?array
77+
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
7278
{
79+
if (!$queryBuilder instanceof QueryBuilder) {
80+
throw new \TypeError(sprintf('Expected an instance of %s, but got %s.', QueryBuilder::class, \is_object($queryBuilder) ? \get_class($queryBuilder) : \gettype($queryBuilder)));
81+
}
82+
7383
return [
7484
$queryBuilder->getQuery()->getSQL(),
7585
array_map([$this, 'parameterToArray'], $queryBuilder->getParameters()->toArray()),

0 commit comments

Comments
 (0)