mirror of
https://github.com/silverstripe/silverstripe-multiform
synced 2024-10-22 11:05:49 +02:00
Merge pull request #17 from sheadawson/master
Use Object::create to create step instances
This commit is contained in:
commit
ad85234158
@ -191,7 +191,7 @@ abstract class MultiForm extends Form {
|
|||||||
|
|
||||||
// Always fall back to creating a new step (in case the session or request data is invalid)
|
// Always fall back to creating a new step (in case the session or request data is invalid)
|
||||||
if(!$currentStep || !$currentStep->ID) {
|
if(!$currentStep || !$currentStep->ID) {
|
||||||
$currentStep = new $startStepClass();
|
$currentStep = Object::create($startStepClass);
|
||||||
$currentStep->SessionID = $this->session->ID;
|
$currentStep->SessionID = $this->session->ID;
|
||||||
$currentStep->write();
|
$currentStep->write();
|
||||||
$this->session->CurrentStepID = $currentStep->ID;
|
$this->session->CurrentStepID = $currentStep->ID;
|
||||||
@ -436,7 +436,7 @@ abstract class MultiForm extends Form {
|
|||||||
|
|
||||||
// Determine whether we can use a step already in the DB, or have to create a new one
|
// 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}")) {
|
if(!$nextStep = DataObject::get_one($nextStepClass, "\"SessionID\" = {$this->session->ID}")) {
|
||||||
$nextStep = new $nextStepClass();
|
$nextStep = Object::create($nextStepClass);
|
||||||
$nextStep->SessionID = $this->session->ID;
|
$nextStep->SessionID = $this->session->ID;
|
||||||
$nextStep->write();
|
$nextStep->write();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user