Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MINOR Better isset checks on Versioned#allVersions() due to changes i…

…n SQLQuery
  • Loading branch information...
commit 75c0fcd0526812c7ed1e2724a3f4cbd56e879f97 1 parent 8d7bfd4
Stig Lindqvist authored slindqvist committed
Showing with 6 additions and 3 deletions.
  1. +6 −3 model/Versioned.php
View
9 model/Versioned.php
@@ -679,7 +679,7 @@ function Versions($filter = "", $sort = "", $limit = "", $join = "", $having = "
* Return a list of all the versions available.
* @param string $filter
*/
- function allVersions($filter = "", $sort = "", $limit = "", $join = "", $having = "") {
+ public function allVersions($filter = "", $sort = "", $limit = "", $join = "", $having = "") {
// Make sure the table names are not postfixed (e.g. _Live)
$oldMode = self::get_reading_mode();
self::reading_stage('Stage');
@@ -687,8 +687,11 @@ function allVersions($filter = "", $sort = "", $limit = "", $join = "", $having
$query = $this->owner->extendedSQL($filter, $sort, $limit, $join, $having);
foreach($query->from as $table => $tableJoin) {
- if($tableJoin[0] == '"') $baseTable = str_replace('"','',$tableJoin);
- else if (substr($tableJoin,0,5) != 'INNER') $query->from[$table] = "LEFT JOIN \"$table\" ON \"$table\".\"RecordID\" = \"{$baseTable}_versions\".\"RecordID\" AND \"$table\".\"Version\" = \"{$baseTable}_versions\".\"Version\"";
+ if(is_string($tableJoin) && $tableJoin[0] == '"') {
+ $baseTable = str_replace('"','',$tableJoin);
+ } elseif(is_string($tableJoin) && substr($tableJoin,0,5) != 'INNER') {
+ $query->from[$table] = "LEFT JOIN \"$table\" ON \"$table\".\"RecordID\" = \"{$baseTable}_versions\".\"RecordID\" AND \"$table\".\"Version\" = \"{$baseTable}_versions\".\"Version\"";
+ }
$query->renameTable($table, $table . '_versions');
}
Please sign in to comment.
Something went wrong with that request. Please try again.