mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Better error handling in Form::__construct() (fixes #5649) (from r105912)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112511 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
09d4d0ccb3
commit
db460ed57f
@ -144,6 +144,10 @@ class Form extends RequestHandler {
|
|||||||
function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null) {
|
function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
if(!$fields instanceof FieldSet) throw new InvalidArgumentException('$fields must be a valid FieldSet instance');
|
||||||
|
if(!$actions instanceof FieldSet) throw new InvalidArgumentException('$fields must be a valid FieldSet instance');
|
||||||
|
if($validator && !$validator instanceof Validator) throw new InvalidArgumentException('$validator must be a Valdidator instance');
|
||||||
|
|
||||||
$fields->setForm($this);
|
$fields->setForm($this);
|
||||||
$actions->setForm($this);
|
$actions->setForm($this);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user