Skip to content

Commit

Permalink
fix(ResultList) Include checks for _all_ stages an item is indexed ag…
Browse files Browse the repository at this point in the history
…ainst
  • Loading branch information
nyeholt committed Nov 19, 2017
1 parent 44900ef commit 8d97803
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Symbiote/Elastica/ResultList.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,18 @@ public function toArray($evaluatePermissions = false, $loadDataObjects = true) {
}

// a double sanity check for the stage here.
$source = $item->getSource();
$stages = isset($source['SS_Stage']) ? $source['SS_Stage'] : [];
if ($currentStage = \Versioned::current_stage()) {
if ($currentStage != $stage) {
if ($currentStage != $stage && !in_array($currentStage, $stages)) {
continue;
}
}

if (class_exists($type) && $loadDataObjects) {
$object = \DataObject::get_by_id($type, $id);
} else {
$object = \ArrayData::create($item->getSource());
$object = \ArrayData::create($source);
}


Expand Down

0 comments on commit 8d97803

Please sign in to comment.