Merge branch '4.2'

* 4.2:
  [Cache] fix create table at prepare time
  fix merge
This commit is contained in:
Nicolas Grekas 2019-01-25 15:56:25 +01:00
commit 0b99eaf553
2 changed files with 8 additions and 18 deletions

View File

@ -74,23 +74,6 @@ class TemplateManagerTest extends TestCase
$this->assertEquals('FooBundle:Collector:foo.html.twig', $this->templateManager->getName(new ProfileDummy(), 'foo'));
}
/**
* template should be loaded for 'foo' because other collectors are
* missing in profile or in profiler.
*/
public function testGetTemplates()
{
$this->profiler->expects($this->any())
->method('has')
->withAnyParameters()
->will($this->returnCallback([$this, 'profileHasCollectorCallback']));
$result = $this->templateManager->getTemplates(new ProfileDummy());
$this->assertArrayHasKey('foo', $result);
$this->assertArrayNotHasKey('bar', $result);
$this->assertArrayNotHasKey('baz', $result);
}
public function profilerHasCallback($panel)
{
switch ($panel) {

View File

@ -306,7 +306,14 @@ trait PdoTrait
$now = time();
$lifetime = $lifetime ?: null;
$stmt = $conn->prepare($sql);
try {
$stmt = $conn->prepare($sql);
} catch (TableNotFoundException $e) {
if (!$conn->isTransactionActive() || \in_array($this->driver, ['pgsql', 'sqlite', 'sqlsrv'], true)) {
$this->createTable();
}
$stmt = $conn->prepare($sql);
}
if ('sqlsrv' === $driver || 'oci' === $driver) {
$stmt->bindParam(1, $id);