/** * Merges an Jelly_Validation_Exception object into the current exception * Useful when you want to combine errors into one array * * @param Jelly_Validation_Exception $object The exception to merge * @param mixed $has_many The array key to use if this exception can be merged multiple times * @return Jelly_Validation_Exception */ public function merge(Jelly_Validation_Exception $object, $has_many = FALSE) { $alias = $object->alias(); // We will need this when generating errors $this->_objects[$alias]['_has_many'] = $has_many !== FALSE; if ($has_many === TRUE) { // This is most likely a has_many relationship $this->_objects[$alias][] = $object->objects(); } elseif ($has_many) { // This is most likely a has_many relationship $this->_objects[$alias][$has_many] = $object->objects(); } else { $this->_objects[$alias] = $object->objects(); } return $this; }