Commit c1a58cdd authored by Ad Schellevis's avatar Ad Schellevis

(mvc) extend basemodel

parent dadbdf90
...@@ -326,10 +326,10 @@ abstract class BaseModel ...@@ -326,10 +326,10 @@ abstract class BaseModel
* perform a validation on changed model fields, using the (renamed) internal reference as a source pointer * perform a validation on changed model fields, using the (renamed) internal reference as a source pointer
* for the requestor to identify its origin * for the requestor to identify its origin
* @param null|string $sourceref source reference, for example model.section * @param null|string $sourceref source reference, for example model.section
* @param null|string $targetref target reference, for example section * @param string $targetref target reference, for example section. used as prefix if no source given
* @return array list of validation errors, indexed by field reference * @return array list of validation errors, indexed by field reference
*/ */
public function validate($sourceref = null, $targetref = null) public function validate($sourceref = null, $targetref = "")
{ {
$result = array(); $result = array();
$valMsgs = $this->performValidation(); $valMsgs = $this->performValidation();
...@@ -339,7 +339,8 @@ abstract class BaseModel ...@@ -339,7 +339,8 @@ abstract class BaseModel
$fieldnm = str_replace($sourceref, $targetref, $msg->getField()); $fieldnm = str_replace($sourceref, $targetref, $msg->getField());
$result[$fieldnm] = $msg->getMessage(); $result[$fieldnm] = $msg->getMessage();
} else { } else {
$result[$msg->getField()] = $msg->getMessage(); $fieldnm = $targetref . $msg->getField() ;
$result[$fieldnm] = $msg->getMessage();
} }
} }
return $result; return $result;
......
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