Skip to content

Commit a74927d

Browse files
committed
Merge branch '2.3' into 2.6
* 2.3: Fix small coding style [2.3] Static Code Analysis for Components [Form] fixed phpdoc CS: Convert double quotes to single quotes Fixed MongoODM entity loader. Improved loading behavior of entities and documents by reusing entity loader. [Validator] added Japanese translation for unmatched charset (id: 80) [DependencyInjection] Highest precedence for user parameters [Translation][MoFileLoader] fixed load empty translation. bumped Symfony version to 2.3.27 updated VERSION for 2.3.26 update CONTRIBUTORS for 2.3.26 updated CHANGELOG for 2.3.26 Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php src/Symfony/Bundle/FrameworkBundle/Command/ContainerDebugCommand.php src/Symfony/Bundle/TwigBundle/Command/LintCommand.php src/Symfony/Component/Config/Definition/ReferenceDumper.php src/Symfony/Component/Debug/ExceptionHandler.php src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php src/Symfony/Component/DependencyInjection/Tests/Compiler/MergeExtensionConfigurationPassTest.php src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php src/Symfony/Component/Filesystem/Filesystem.php src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Serializer/Encoder/XmlEncoder.php src/Symfony/Component/Translation/PluralizationRules.php src/Symfony/Component/Validator/Constraints/IssnValidator.php src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf src/Symfony/Component/Yaml/Tests/InlineTest.php
2 parents f7df529 + 8b64e43 commit a74927d

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

Form/ChoiceList/EntityChoiceList.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,8 @@ public function getChoicesForValues(array $values)
218218
if (!$this->loaded) {
219219
// Optimize performance in case we have an entity loader and
220220
// a single-field identifier
221-
if ($this->idAsValue) {
222-
$unorderedEntities = $this->entityLoader
223-
? $this->entityLoader->getEntitiesByIds($this->idField, $values)
224-
: $this->em->getRepository($this->class)->findBy(array($this->idField => $values));
221+
if ($this->idAsValue && $this->entityLoader) {
222+
$unorderedEntities = $this->entityLoader->getEntitiesByIds($this->idField, $values);
225223
$entitiesByValue = array();
226224
$entities = array();
227225

Form/Type/DoctrineType.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
6666
$type = $this;
6767

6868
$loader = function (Options $options) use ($type) {
69-
if (null !== $options['query_builder']) {
70-
return $type->getLoader($options['em'], $options['query_builder'], $options['class']);
71-
}
69+
$queryBuilder = (null !== $options['query_builder'])
70+
? $options['query_builder']
71+
: $options['em']->getRepository($options['class'])->createQueryBuilder('e');
72+
73+
return $type->getLoader($options['em'], $queryBuilder, $options['class']);
7274
};
7375

7476
$choiceList = function (Options $options) use (&$choiceListCache, $propertyAccessor) {

Security/User/EntityUserProvider.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ public function refreshUser(UserInterface $user)
8585
// That's the case when the user has been changed by a form with
8686
// validation errors.
8787
if (!$id = $this->metadata->getIdentifierValues($user)) {
88-
throw new \InvalidArgumentException("You cannot refresh a user ".
89-
"from the EntityUserProvider that does not contain an identifier. ".
90-
"The user object has to be serialized with its own identifier ".
91-
"mapped by Doctrine."
88+
throw new \InvalidArgumentException('You cannot refresh a user '.
89+
'from the EntityUserProvider that does not contain an identifier. '.
90+
'The user object has to be serialized with its own identifier '.
91+
'mapped by Doctrine.'
9292
);
9393
}
9494

Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testCollectQueryCount()
3939
$this->assertEquals(0, $c->getQueryCount());
4040

4141
$queries = array(
42-
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 0),
42+
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 0),
4343
);
4444
$c = $this->createCollector($queries);
4545
$c->collect(new Request(), new Response());
@@ -53,15 +53,15 @@ public function testCollectTime()
5353
$this->assertEquals(0, $c->getTime());
5454

5555
$queries = array(
56-
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
56+
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1),
5757
);
5858
$c = $this->createCollector($queries);
5959
$c->collect(new Request(), new Response());
6060
$this->assertEquals(1, $c->getTime());
6161

6262
$queries = array(
63-
array('sql' => "SELECT * FROM table1", 'params' => array(), 'types' => array(), 'executionMS' => 1),
64-
array('sql' => "SELECT * FROM table2", 'params' => array(), 'types' => array(), 'executionMS' => 2),
63+
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1),
64+
array('sql' => 'SELECT * FROM table2', 'params' => array(), 'types' => array(), 'executionMS' => 2),
6565
);
6666
$c = $this->createCollector($queries);
6767
$c->collect(new Request(), new Response());
@@ -74,7 +74,7 @@ public function testCollectTime()
7474
public function testCollectQueries($param, $types, $expected, $explainable)
7575
{
7676
$queries = array(
77-
array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1),
77+
array('sql' => 'SELECT * FROM table1 WHERE field1 = ?1', 'params' => array($param), 'types' => $types, 'executionMS' => 1),
7878
);
7979
$c = $this->createCollector($queries);
8080
$c->collect(new Request(), new Response());
@@ -90,7 +90,7 @@ public function testCollectQueries($param, $types, $expected, $explainable)
9090
public function testSerialization($param, $types, $expected, $explainable)
9191
{
9292
$queries = array(
93-
array('sql' => "SELECT * FROM table1 WHERE field1 = ?1", 'params' => array($param), 'types' => $types, 'executionMS' => 1),
93+
array('sql' => 'SELECT * FROM table1 WHERE field1 = ?1', 'params' => array($param), 'types' => $types, 'executionMS' => 1),
9494
);
9595
$c = $this->createCollector($queries);
9696
$c->collect(new Request(), new Response());

Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ public function testValidateUniquenessWithValidCustomErrorPath()
250250
'message' => 'myMessage',
251251
'fields' => array('name', 'name2'),
252252
'em' => self::EM_NAME,
253-
'errorPath' => "name2",
253+
'errorPath' => 'name2',
254254
));
255255

256-
$entity1 = new DoubleNameEntity(1, 'Foo', "Bar");
257-
$entity2 = new DoubleNameEntity(2, 'Foo', "Bar");
256+
$entity1 = new DoubleNameEntity(1, 'Foo', 'Bar');
257+
$entity2 = new DoubleNameEntity(2, 'Foo', 'Bar');
258258

259259
$this->validator->validate($entity1, $constraint);
260260

@@ -405,7 +405,7 @@ public function testAssociatedCompositeEntity()
405405
'em' => self::EM_NAME,
406406
));
407407

408-
$composite = new CompositeIntIdEntity(1, 1, "test");
408+
$composite = new CompositeIntIdEntity(1, 1, 'test');
409409
$associated = new AssociationEntity();
410410
$associated->composite = $composite;
411411

Validator/Constraints/UniqueEntityValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ public function validate($entity, Constraint $constraint)
102102

103103
if (count($relatedId) > 1) {
104104
throw new ConstraintDefinitionException(
105-
"Associated entities are not allowed to have more than one identifier field to be ".
106-
"part of a unique constraint in: ".$class->getName()."#".$fieldName
105+
'Associated entities are not allowed to have more than one identifier field to be '.
106+
'part of a unique constraint in: '.$class->getName().'#'.$fieldName
107107
);
108108
}
109109
$criteria[$fieldName] = array_pop($relatedId);

0 commit comments

Comments
 (0)