Skip to content

Commit 63c9541

Browse files
Merge branch '2.8' into 3.0
* 2.8: [HttpFoundation] Fix UPSERT for PgSql >= 9.5 [Form] fixed DateTime transformers [PropertyAccess][DX] Enhance exception that say that some methods are missing if they don't [Form] fixed EntityType test with query_builder option Conflicts: src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php
2 parents 8798a33 + 9d82a82 commit 63c9541

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

HttpFoundation/DbalSessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private function getMergeSql()
243243
return "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time)";
244244
case 'postgresql' === $platform && version_compare($this->con->getServerVersion(), '9.5', '>='):
245245
return "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->timeCol) VALUES (:id, :data, :time) ".
246-
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (:data, :time) WHERE $this->idCol = :id";
246+
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->timeCol)";
247247
}
248248
}
249249
}

Tests/Form/Type/EntityTypeTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,13 @@ public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
209209
$field->submit('2');
210210
}
211211

212-
public function testConfigureQueryBuilderWithClosureReturningNull()
212+
public function testConfigureQueryBuilderWithClosureReturningNullUseDefault()
213213
{
214+
$entity1 = new SingleIntIdEntity(1, 'Foo');
215+
$entity2 = new SingleIntIdEntity(2, 'Bar');
216+
217+
$this->persist(array($entity1, $entity2));
218+
214219
$field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
215220
'em' => 'default',
216221
'class' => self::SINGLE_IDENT_CLASS,
@@ -219,7 +224,7 @@ public function testConfigureQueryBuilderWithClosureReturningNull()
219224
},
220225
));
221226

222-
$this->assertEquals(array(), $field->createView()->vars['choices']);
227+
$this->assertEquals(array(1 => new ChoiceView($entity1, '1', 'Foo'), 2 => new ChoiceView($entity2, '2', 'Bar')), $field->createView()->vars['choices']);
223228
}
224229

225230
public function testSetDataSingleNull()

0 commit comments

Comments
 (0)