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

This commit is contained in:
Andrew Short 2013-10-04 00:04:55 +10:00
parent bb7c973e34
commit deb1bfbcba

View File

@ -182,13 +182,13 @@ class Versioned extends DataExtension {
* @todo Should this all go into VersionedDataQuery? * @todo Should this all go into VersionedDataQuery?
*/ */
public function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) { public function augmentSQL(SQLQuery &$query, DataQuery &$dataQuery = null) {
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass()); if(!$dataQuery || !$dataQuery->getQueryParam('Versioned.mode')) {
return;
switch($dataQuery->getQueryParam('Versioned.mode')) { }
// Noop
case '':
break;
$baseTable = ClassInfo::baseDataClass($dataQuery->dataClass());
switch($dataQuery->getQueryParam('Versioned.mode')) {
// Reading a specific data from the archive // Reading a specific data from the archive
case 'archive': case 'archive':
$date = $dataQuery->getQueryParam('Versioned.date'); $date = $dataQuery->getQueryParam('Versioned.date');