Skip to content

Commit

Permalink
MINOR Use injector to create controllers in ModelAsController
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Nyeholt committed May 30, 2012
1 parent ad28780 commit 9f51c87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/controllers/ModelAsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function controller_for(SiteTree $sitetree, $action = null) {
$controller = $controller . '_' . ucfirst($action);
}

return class_exists($controller) ? new $controller($sitetree) : $sitetree;
return class_exists($controller) ? Injector::inst()->create($controller, $sitetree) : $sitetree;
}

public function init() {
Expand Down

0 comments on commit 9f51c87

Please sign in to comment.