Merge pull request #75 from firebrandhq/1.3

Ensure compatibility with SS 3.7 & PHP 7.2
This commit is contained in:
Robbie Averill 2018-10-05 10:26:42 +00:00 committed by GitHub
commit 6a019d2594
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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();
}