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)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@105912 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
ead4ac2571
commit
c27c9eb22f
@ -143,6 +143,10 @@ class Form extends RequestHandler {
|
||||
*/
|
||||
function __construct($controller, $name, FieldSet $fields, FieldSet $actions, $validator = null) {
|
||||
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);
|
||||
$actions->setForm($this);
|
||||
|
Loading…
Reference in New Issue
Block a user