Browse files

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...
forsdahl committed Aug 2, 2012
1 parent bbb0868 commit 76c5b56e814ccf569a5c4020736e6e20cc8aef34
Showing with 1 addition and 1 deletion.
  1. +1 −1 model/DataQuery.php
@@ -227,7 +227,7 @@ function getFinalisedQuery($queriedColumns = null) {
// TODO: Versioned, Translatable, SiteTreeSubsites, etc, could probably be better implemented as subclasses of DataQuery
- $obj = Injector::inst()->get(ClassInfo::baseDataClass($this->dataClass));
+ $obj = Injector::inst()->get($this->dataClass);
$obj->extend('augmentSQL', $query, $this);

0 comments on commit 76c5b56

Please sign in to comment.