diff --git a/runtime/lib/Propel.php b/runtime/lib/Propel.php index 9a6ac2e9d..deac8b765 100644 --- a/runtime/lib/Propel.php +++ b/runtime/lib/Propel.php @@ -686,6 +686,13 @@ public static function initConnection($conparams, $name, $defaultClass = Propel: $con = new $classname($dsn, $user, $password, $driver_options); $con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $con->setAttribute(PropelPDO::PROPEL_ATTR_CONNECTION_NAME, $name); + + // With the PropelBundle Symfony integration there is no way to correctly specify PDO attributes. + // The configuration schema requires a scalar value, however Propel requires a keyed 'value' array. + // This allows us to specify the timeout within the runtime environment (i.e for Lambda). + if ($connectionTimeout = \getenv('PROPEL_PDO_CONNECTION_TIMEOUT')) { + $con->setAttribute(\PDO::ATTR_TIMEOUT, $connectionTimeout); + } } catch (PDOException $e) { throw new PropelException("Unable to open PDO connection", $e); }