Skip to content

Commit aadcd9a

Browse files
committed
Fixed LSB issue with pdo repository
1 parent f4c913b commit aadcd9a

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
### 1.5.3
4+
5+
* Fixed: LSB issue with pdo repository
6+
* Changed: write stickness setting defaults to true
7+
38
### 1.5.2
49

510
* Added: Read/Write connection splitting support

src/Repositories/MySql/MySql.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function fetchMissingObjectData(Model $object, $uniqueIdentifier, $rel
108108
$data = self::returnFirstRow(
109109
"SELECT * FROM `" . $table . "` WHERE `{$schema->uniqueIdentifierColumnName}` = :id",
110110
["id" => $uniqueIdentifier],
111-
self::getReadOnlyConnection()
111+
static::getReadOnlyConnection()
112112
);
113113

114114
if ($data != null) {
@@ -302,7 +302,7 @@ public function createCursorForCollection(RepositoryCollection $collection)
302302
$sql = preg_replace("/^SELECT /", "SELECT SQL_CALC_FOUND_ROWS ", $sql);
303303
}
304304

305-
$connection = self::getReadOnlyConnection();
305+
$connection = static::getReadOnlyConnection();
306306
$statement = static::executeStatement((string)$sql, $params, $connection);
307307

308308
$count = $statement->rowCount();

src/Repositories/PdoRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static function getReadOnlyConnection()
116116
}
117117
self::$readOnlyConnection = static::getConnection($readOnlySettings);
118118
} else {
119-
self::$readOnlyConnection = self::getDefaultConnection();
119+
self::$readOnlyConnection = static::getDefaultConnection();
120120
}
121121
}
122122

@@ -278,7 +278,7 @@ public static function returnSingleValue($statement, $namedParameters = [], $con
278278
$statement = self::executeStatement(
279279
$statement,
280280
$namedParameters,
281-
$connection !== null ? $connection : self::getReadOnlyConnection()
281+
$connection !== null ? $connection : static::getReadOnlyConnection()
282282
);
283283

284284
return $statement->fetchColumn(0);
@@ -297,7 +297,7 @@ public static function returnFirstRow($statement, $namedParameters = [], $connec
297297
$statement = self::executeStatement(
298298
$statement,
299299
$namedParameters,
300-
$connection !== null ? $connection : self::getReadOnlyConnection()
300+
$connection !== null ? $connection : static::getReadOnlyConnection()
301301
);
302302

303303
return $statement->fetch(\PDO::FETCH_ASSOC);

src/StemSettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class StemSettings extends Settings
4040

4141
// Useful if you intend to read immediately after writing and your read only connection has lag (eg replication).
4242
// This will probably make read only connections pointless if writes happen throughout reads (eg db logging).
43-
public $stickyWriteConnection = false;
43+
public $stickyWriteConnection = true;
4444

4545
/**
4646
* @var \DateTimeZone

0 commit comments

Comments
 (0)