mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Tidy up enum matching where classname is missing
This commit is contained in:
parent
6ea59e68ad
commit
20e082d00e
@ -38,7 +38,7 @@ class Enum extends StringField {
|
|||||||
public function __construct($name = null, $enum = NULL, $default = NULL) {
|
public function __construct($name = null, $enum = NULL, $default = NULL) {
|
||||||
if($enum) {
|
if($enum) {
|
||||||
if(!is_array($enum)) {
|
if(!is_array($enum)) {
|
||||||
$enum = preg_split("/ *, */", trim($enum));
|
$enum = preg_split("/ *, */", trim(trim($enum, ',')));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->enum = $enum;
|
$this->enum = $enum;
|
||||||
|
@ -18,7 +18,7 @@ class MultiEnum extends Enum {
|
|||||||
// Validate and assign the default
|
// Validate and assign the default
|
||||||
$this->default = null;
|
$this->default = null;
|
||||||
if($default) {
|
if($default) {
|
||||||
$defaults = preg_split('/ *, */',trim($default));
|
$defaults = preg_split('/ *, */',trim(trim($default, ',')));
|
||||||
foreach($defaults as $thisDefault) {
|
foreach($defaults as $thisDefault) {
|
||||||
if(!in_array($thisDefault, $this->enum)) {
|
if(!in_array($thisDefault, $this->enum)) {
|
||||||
user_error("Enum::__construct() The default value '$thisDefault' does not match "
|
user_error("Enum::__construct() The default value '$thisDefault' does not match "
|
||||||
|
Loading…
Reference in New Issue
Block a user