Extends
lithium\core\Object
Access the errors of the record.
Parameters
- array|string $field If an array, overwrites `$this->_errors`. If a string, and `$value` is not `null`, sets the corresponding key in `$this->_errors` to `$value`.
- string $value Value to set.
Returns
mixed Either the `$this->_errors` array, or single value from it.Source
public function errors($field = null, $value = null) {
if ($field === null) {
return $this->_errors;
}
if (is_array($field)) {
return ($this->_errors = $field);
}
if ($value === null && isset($this->_errors[$field])) {
return $this->_errors[$field];
}
if ($value !== null) {
return $this->_errors[$field] = $value;
}
return $value;
}