public function __construct($name, $enum = NULL, $default = NULL)
 {
     // MultiEnum needs to take care of its own defaults
     parent::__construct($name, $enum, null);
     // Validate and assign the default
     $this->default = null;
     if ($default) {
         $defaults = preg_split('/ *, */', trim($default));
         foreach ($defaults as $thisDefault) {
             if (!in_array($thisDefault, $this->enum)) {
                 user_error("Enum::__construct() The default value '{$thisDefault}' does not match " . "any item in the enumeration", E_USER_ERROR);
                 return;
             }
         }
         $this->default = implode(',', $defaults);
     }
 }
 public function getDefault()
 {
     // Check for assigned default
     $default = parent::getDefault();
     if ($default) {
         return $default;
     }
     // Allow classes to set default class
     $baseClass = $this->getBaseClass();
     $defaultClass = Config::inst()->get($baseClass, 'default_classname');
     if ($defaultClass && class_exists($defaultClass)) {
         return $defaultClass;
     }
     // Fallback to first option
     $enum = $this->getEnum();
     return reset($enum);
 }