Merge branch '3.4' into 4.4

* 3.4:
  [FrameworkBundle] fix "samesite" in XSD
  Update UserPasswordEncoderCommand.php
  [HttpFoundation][FrameworkBundle] fix support for samesite in session cookies
  [DoctrineBridge] Fixed submitting ids with query limit or offset
This commit is contained in:
Nicolas Grekas 2020-02-07 09:47:19 +01:00
commit df41ca5b71
4 changed files with 31 additions and 5 deletions

View File

@ -57,7 +57,7 @@ class ORMQueryBuilderLoader implements EntityLoaderInterface
$metadata = $this->queryBuilder->getEntityManager()->getClassMetadata(current($this->queryBuilder->getRootEntities()));
foreach ($this->getEntities() as $entity) {
if (\in_array(current($metadata->getIdentifierValues($entity)), $values, true)) {
if (\in_array((string) current($metadata->getIdentifierValues($entity)), $values, true)) {
$choices[] = $entity;
}
}

View File

@ -953,7 +953,32 @@ class EntityTypeTest extends BaseTypeTest
$this->assertNull($field->getData());
}
public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifierWithLimit()
public function testSingleIdentifierWithLimit()
{
$entity1 = new SingleIntIdEntity(1, 'Foo');
$entity2 = new SingleIntIdEntity(2, 'Bar');
$entity3 = new SingleIntIdEntity(3, 'Baz');
$this->persist([$entity1, $entity2, $entity3]);
$repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
$field = $this->factory->createNamed('name', static::TESTED_TYPE, null, [
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => $repository->createQueryBuilder('e')
->where('e.id IN (1, 2, 3)')
->setMaxResults(1),
'choice_label' => 'name',
]);
$field->submit('1');
$this->assertTrue($field->isSynchronized());
$this->assertSame($entity1, $field->getData());
}
public function testDisallowChoicesThatAreNotIncludedByQueryBuilderSingleIdentifierWithLimit()
{
$entity1 = new SingleIntIdEntity(1, 'Foo');
$entity2 = new SingleIntIdEntity(2, 'Bar');

View File

@ -375,6 +375,7 @@
<xsd:simpleType name="cookie_samesite">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="" />
<xsd:enumeration value="none" />
<xsd:enumeration value="lax" />
<xsd:enumeration value="strict" />
</xsd:restriction>

View File

@ -82,16 +82,16 @@ generated to encode the password:
Pass the full user class path as the second argument to encode passwords for
your own entities:
<info>php %command.full_name% --no-interaction [password] App\Entity\User</info>
<info>php %command.full_name% --no-interaction [password] 'App\Entity\User'</info>
Executing the command interactively allows you to generate a random salt for
encoding the password:
<info>php %command.full_name% [password] App\Entity\User</info>
<info>php %command.full_name% [password] 'App\Entity\User'</info>
In case your encoder doesn't require a salt, add the <comment>empty-salt</comment> option:
<info>php %command.full_name% --empty-salt [password] App\Entity\User</info>
<info>php %command.full_name% --empty-salt [password] 'App\Entity\User'</info>
EOF
)