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
if ($this->internalValue != null) {
if (array_key_exists($this->internalCacheKey, self::$internalOptionList) &&
count(self::$internalOptionList[$this->internalCacheKey]) > 0) {
return array(new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array_keys(self::$internalOptionList[$this->internalCacheKey]))));
$validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array_keys(self::$internalOptionList[$this->internalCacheKey])));
} else {
return array(new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array())));
$validators[] = new InclusionIn(array('message' => $this->internalValidationMessage,
'domain' => array()));
}
}
return $validators;
......
......@@ -127,7 +127,7 @@ class PortField extends BaseField
*/
public function getValidators()
{
$validators = parent::getValidators();
if ($this->internalValidationMessage == null) {
$msg = "please specify a valid portnumber (1-65535) or name (" . implode(",", self::$wellknownservices) .
")" ;
......@@ -137,10 +137,8 @@ class PortField extends BaseField
if (($this->internalIsRequired == true || $this->internalValue != null) &&
count(self::$internalOptionList) > 0) {
return array(new InclusionIn(array('message' => $msg,'domain'=>self::$internalOptionList)));
} else {
// empty field and not required, skip this validation.
return array();
$validators[] = new InclusionIn(array('message' => $msg,'domain'=>self::$internalOptionList));
}
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