Skip to content

Commit

Permalink
Use SS_Object instead of Object
Browse files Browse the repository at this point in the history
  • Loading branch information
Zauberfisch committed Mar 12, 2020
1 parent ce86520 commit 32d47b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
"issues": "https://github.com/Zauberfisch/silverstripe-persistent-dataobject/issues"
},
"require": {
"silverstripe/framework": "^3.6"
"silverstripe/framework": "^3.7"
}
}
14 changes: 7 additions & 7 deletions src/Form/GridField/DetailForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function getURLHandlers($gridField) {
'version-group/$VersionGroupID/item/$ID' => 'handleVersionedItem',
], parent::getURLHandlers($gridField));
}

/**
* @param \GridField $gridField
* @param \SS_HTTPRequest $request
Expand All @@ -21,10 +21,10 @@ public function handleVersionedItem($gridField, $request) {
// It could also give us a RequestHandler in the form of GridFieldDetailForm_ItemRequest if this is a
// nested GridField.
$requestHandler = $gridField->getForm()->getController();

$versionedID = $request->param('VersionGroupID');
$id = $request->param('ID');

if ($versionedID && is_numeric($versionedID)) {
/** @var \DataList $list */
$list = $gridField->getList();
Expand All @@ -36,13 +36,13 @@ public function handleVersionedItem($gridField, $request) {
$record = $list->filter('VersionGroupLatest', true)->first();
}
} else {
$record = \Object::create($gridField->getModelClass());
$record = \SS_Object::create($gridField->getModelClass());
}
$class = $this->getItemRequestClass();
/** @var DetailForm_ItemRequest $handler */
$handler = \Object::create($class, $gridField, $this, $record, $requestHandler, $this->name);
$handler = \SS_Object::create($class, $gridField, $this, $record, $requestHandler, $this->name);
$handler->setTemplate($this->template);

// if no validator has been set on the GridField and the record has a CMS validator, use that.
if (!$this->getValidator()
&& (
Expand All @@ -55,5 +55,5 @@ public function handleVersionedItem($gridField, $request) {
}
return $handler->handleRequest($request, \DataModel::inst());
}

}

0 comments on commit 32d47b2

Please sign in to comment.