Ensure compatibility with SS 3.7 & PHP 7.2

This commit is contained in:
Marc Espiard 2018-10-05 10:55:32 +13:00
parent e8fc4fca46
commit ef12c37ca7
2 changed files with 7 additions and 2 deletions

5
_config.php Normal file → Executable file
View File

@ -1,2 +1,7 @@
<?php
// Ensure compatibility with PHP 7.2 ("object" is a reserved word),
// with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object)
if (!class_exists('SS_Object')) {
class_alias('Object', 'SS_Object');
}

4
code/model/MultiForm.php Normal file → Executable file
View File

@ -221,7 +221,7 @@ abstract class MultiForm extends Form {
// Always fall back to creating a new step (in case the session or request data is invalid)
if(!$currentStep || !$currentStep->ID) {
$currentStep = Object::create($startStepClass);
$currentStep = SS_Object::create($startStepClass);
$currentStep->SessionID = $this->session->ID;
$currentStep->write();
$this->session->CurrentStepID = $currentStep->ID;
@ -483,7 +483,7 @@ abstract class MultiForm extends Form {
// Determine whether we can use a step already in the DB, or have to create a new one
if(!$nextStep = DataObject::get_one($nextStepClass, "\"SessionID\" = {$this->session->ID}")) {
$nextStep = Object::create($nextStepClass);
$nextStep = SS_Object::create($nextStepClass);
$nextStep->SessionID = $this->session->ID;
$nextStep->write();
}