mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-29 20:59:23 +02:00
BUGFIX: Fixed bug in recent changes to Hierarchy::liveChildren() to do with Translatable
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@87228 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
45fb4e0182
commit
2402f308e1
@ -530,13 +530,15 @@ class Hierarchy extends DataObjectDecorator {
|
|||||||
$oldStage = Versioned::current_stage();
|
$oldStage = Versioned::current_stage();
|
||||||
Versioned::reading_stage('Live');
|
Versioned::reading_stage('Live');
|
||||||
|
|
||||||
$query = $this->owner->extendedSQL($filter, null, null, $join);
|
// Singleton is necessary and not $this->owner so as not to muck with Translatable's
|
||||||
|
// behaviour.
|
||||||
|
$query = singleton($baseClass)->extendedSQL($filter, null, null, $join);
|
||||||
|
|
||||||
// Since we didn't include double quotes in the join & filter, we need to add them into the
|
// Since we didn't include double quotes in the join & filter, we need to add them into the
|
||||||
// SQL now, after Versioned has done is query rewriting
|
// SQL now, after Versioned has done is query rewriting
|
||||||
$correctedSQL = str_replace(array("LEFT JOIN {$baseClass}", "{$baseClass}.\"ID\""),
|
$correctedSQL = str_replace(array("LEFT JOIN {$baseClass}", "{$baseClass}.\"ID\""),
|
||||||
array("LEFT JOIN \"{$baseClass}\"", "\"{$baseClass}\".\"ID\""), $query->sql());
|
array("LEFT JOIN \"{$baseClass}\"", "\"{$baseClass}\".\"ID\""), $query->sql());
|
||||||
|
|
||||||
$result = $this->owner->buildDataObjectSet(DB::query($correctedSQL));
|
$result = $this->owner->buildDataObjectSet(DB::query($correctedSQL));
|
||||||
|
|
||||||
Versioned::reading_stage($oldStage);
|
Versioned::reading_stage($oldStage);
|
||||||
|
Loading…
Reference in New Issue
Block a user