Merge branch '4.2'
* 4.2: [Cache] fix create table at prepare time fix merge
This commit is contained in:
commit
0b99eaf553
@ -74,23 +74,6 @@ class TemplateManagerTest extends TestCase
|
|||||||
$this->assertEquals('FooBundle:Collector:foo.html.twig', $this->templateManager->getName(new ProfileDummy(), 'foo'));
|
$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)
|
public function profilerHasCallback($panel)
|
||||||
{
|
{
|
||||||
switch ($panel) {
|
switch ($panel) {
|
||||||
|
@ -306,7 +306,14 @@ trait PdoTrait
|
|||||||
|
|
||||||
$now = time();
|
$now = time();
|
||||||
$lifetime = $lifetime ?: null;
|
$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) {
|
if ('sqlsrv' === $driver || 'oci' === $driver) {
|
||||||
$stmt->bindParam(1, $id);
|
$stmt->bindParam(1, $id);
|
||||||
|
Reference in New Issue
Block a user