Merge pull request #17 from sheadawson/master

Use Object::create to create step instances
This commit is contained in:
Will Rossiter 2013-12-09 22:35:54 -08:00
commit ad85234158

View File

@ -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)
if(!$currentStep || !$currentStep->ID) {
$currentStep = new $startStepClass();
$currentStep = Object::create($startStepClass);
$currentStep->SessionID = $this->session->ID;
$currentStep->write();
$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
if(!$nextStep = DataObject::get_one($nextStepClass, "\"SessionID\" = {$this->session->ID}")) {
$nextStep = new $nextStepClass();
$nextStep = Object::create($nextStepClass);
$nextStep->SessionID = $this->session->ID;
$nextStep->write();
}