Skip to content
This repository
Browse code

BUG: augmentSQL always extended on base data class on query finalization

The augmentSQL DataExtension method is always extended on the base data
class of data objects in DataQuery::getFinilisedQuery(). This results
in augmentSQL not being called for extensions that are applied to non-
base data classes when finalizing the query.

For example, if Versioned was applied to class B which extends class A,
which in turn extends DataObject, then augmentSQL would be extended for
class A in DataQuery::getFinilisedQuery(). Since class A doesn't have
the Versioned extension in this example, it would not work for class B.

Fixed this by extending augmentSQL on the actual data class and not
on the base class.
  • Loading branch information...
commit 76c5b56e814ccf569a5c4020736e6e20cc8aef34 1 parent bbb0868
Niklas Forsdahl authored August 02, 2012

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  model/DataQuery.php
2  model/DataQuery.php
@@ -227,7 +227,7 @@ function getFinalisedQuery($queriedColumns = null) {
227 227
 
228 228
 		// TODO: Versioned, Translatable, SiteTreeSubsites, etc, could probably be better implemented as subclasses of DataQuery
229 229
 
230  
-		$obj = Injector::inst()->get(ClassInfo::baseDataClass($this->dataClass));
  230
+		$obj = Injector::inst()->get($this->dataClass);
231 231
 		$obj->extend('augmentSQL', $query, $this);
232 232
 
233 233
 		$this->ensureSelectContainsOrderbyColumns($query);

0 notes on commit 76c5b56

Please sign in to comment.
Something went wrong with that request. Please try again.