Use filter API for previous steps

This commit is contained in:
Will Rossiter 2017-10-01 12:50:34 +13:00
parent f04a6026e6
commit 9861d7cad2

View File

@ -308,7 +308,8 @@ class MultiFormStep extends DataObject
*/ */
public function getPreviousStep() public function getPreviousStep()
{ {
$steps = DataObject::get(MultiFormStep::class, "\"SessionID\" = {$this->SessionID}", '"LastEdited" DESC'); $steps = MultiFormStep::get()->filter('SessionID', $this->SessionID)->sort('LastEdited', 'DESC');
if ($steps) { if ($steps) {
foreach ($steps as $step) { foreach ($steps as $step) {
$step->setForm($this->form); $step->setForm($this->form);