Commit 3cf46824 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(mvc) formalize fieldtypes

(cherry picked from commit 2d671594)
parent 4f02aece
...@@ -144,11 +144,11 @@ class ModelRelationField extends BaseField ...@@ -144,11 +144,11 @@ class ModelRelationField extends BaseField
if ($this->internalValue != null) { if ($this->internalValue != null) {
if (array_key_exists($this->internalCacheKey, self::$internalOptionList) && if (array_key_exists($this->internalCacheKey, self::$internalOptionList) &&
count(self::$internalOptionList[$this->internalCacheKey]) > 0) { count(self::$internalOptionList[$this->internalCacheKey]) > 0) {
return array(new InclusionIn(array('message' => $this->internalValidationMessage, $validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array_keys(self::$internalOptionList[$this->internalCacheKey])))); 'domain' => array_keys(self::$internalOptionList[$this->internalCacheKey])));
} else { } else {
return array(new InclusionIn(array('message' => $this->internalValidationMessage, $validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array()))); 'domain' => array()));
} }
} }
return $validators; return $validators;
......
...@@ -127,7 +127,7 @@ class PortField extends BaseField ...@@ -127,7 +127,7 @@ class PortField extends BaseField
*/ */
public function getValidators() public function getValidators()
{ {
$validators = parent::getValidators();
if ($this->internalValidationMessage == null) { if ($this->internalValidationMessage == null) {
$msg = "please specify a valid portnumber (1-65535) or name (" . implode(",", self::$wellknownservices) . $msg = "please specify a valid portnumber (1-65535) or name (" . implode(",", self::$wellknownservices) .
")" ; ")" ;
...@@ -137,10 +137,8 @@ class PortField extends BaseField ...@@ -137,10 +137,8 @@ class PortField extends BaseField
if (($this->internalIsRequired == true || $this->internalValue != null) && if (($this->internalIsRequired == true || $this->internalValue != null) &&
count(self::$internalOptionList) > 0) { count(self::$internalOptionList) > 0) {
return array(new InclusionIn(array('message' => $msg,'domain'=>self::$internalOptionList))); $validators[] = new InclusionIn(array('message' => $msg,'domain'=>self::$internalOptionList));
} else {
// empty field and not required, skip this validation.
return array();
} }
return $validators;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment