Skip to content

Commit

Permalink
FIX: Fixes silverstripe#65 Use Injector to instantiate created object…
Browse files Browse the repository at this point in the history
  • Loading branch information
phptek authored and Russell Michell committed May 17, 2019
1 parent cd4c743 commit 246ba9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/RestfulServer.php
Expand Up @@ -15,6 +15,7 @@
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Core\Injector\Injector;

/**
* Generic RESTful server, which handles webservice access to arbitrary DataObjects.
Expand Down Expand Up @@ -571,7 +572,8 @@ protected function postHandler($className, $id, $relation)
if (!singleton($className)->canCreate($this->getMember())) {
return $this->permissionFailure();
}
$obj = new $className();

$obj = Injector::inst()->create($className);

$reqFormatter = $this->getRequestDataFormatter($className);
if (!$reqFormatter) {
Expand Down

0 comments on commit 246ba9e

Please sign in to comment.