Merge pull request #215 from bar/1.3-fix-extract

Minor updates to Helper.
This commit is contained in:
Mark Story 2011-09-27 17:01:06 -07:00
commit b3e57e0feb

View file

@ -573,20 +573,20 @@ class Helper extends Overloadable {
}
/**
* Returns false if given FORM field has no errors. Otherwise it returns the constant set in
* Returns null if given FORM field has no errors. Otherwise it returns the constant set in
* the array Model->validationErrors.
*
* @param string $model Model name as a string
* @param string $field Fieldname as a string
* @param integer $modelID Unique index identifying this record within the form
* @return boolean True on errors.
* @return mixed Null if no errors, string with error otherwhise.
*/
function tagIsInvalid($model = null, $field = null, $modelID = null) {
$view =& ClassRegistry::getObject('view');
$errors = $this->validationErrors;
$entity = $view->entity();
if (!empty($entity)) {
return Set::extract($errors, join('.', $entity));
return Set::extract(join('.', $entity), $errors);
}
}
@ -704,7 +704,7 @@ class Helper extends Overloadable {
$entity = $view->entity();
if (!empty($this->data) && !empty($entity)) {
$result = Set::extract($this->data, join('.', $entity));
$result = Set::extract(join('.', $entity), $this->data);
}
$habtmKey = $this->field();