Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix Versioned::augmentSQL() when the data query was null. #2482

Merged
merged 1 commit into from

3 participants

@ajshort

No description provided.

@halkyon
Owner

What's the context of this? A unit test might help to explain the case where this is a problem.

@halkyon
Owner

Hasn't had a reply for a month. @ajshort ? :)

@simonwelsh simonwelsh merged commit 5b22153 into silverstripe:3.1

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 model/Versioned.php
View
10 model/Versioned.php
@@ -182,13 +182,13 @@ public function augmentDataQueryCreation(SQLQuery &$query, DataQuery &$dataQuery
* @todo Should this all go into VersionedDataQuery?
*/
public function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
+ if(!$dataQuery || !$dataQuery->getQueryParam('Versioned.mode')) {
+ return;
+ }
+
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass());
-
- switch($dataQuery->getQueryParam('Versioned.mode')) {
- // Noop
- case '':
- break;
+ switch($dataQuery->getQueryParam('Versioned.mode')) {
// Reading a specific data from the archive
case 'archive':
$date = $dataQuery->getQueryParam('Versioned.date');
Something went wrong with that request. Please try again.