protected function mergeErrors(array $errors1, array $errors2) {
		foreach($errors2['rules'] as $name=>$rule) {
			if(isset($errors1['rules'][$name])) {
				$i=1;
				while(isset($errors1['rules'][$name.'-'.$i])) { $i += 1; }
				$name = $name.'-'.$i;
			}
			$errors1['rules'][$name] = $rule;
		}
		foreach($errors2['attributes'] as $attribute=>$errors) {
			if(isset($errors1['attributes'][$attribute]))
				$errors1['attributes'][$attribute] = $this->mergeErrors($errors1['attributes'][$attribute], $errors2['attributes'][$attribute]);
			else
				$errors1['attributes'] = $errors2['attributes'];
		}
		return $errors1;
	}
protected function mergeErrors(array $errors1, array $errors2) {
		foreach($errors2['rules'] as $name=>$rule) {
			if(isset($errors1['rules'][$name])) {
				$i=1;
				while(isset($errors1['rules'][$name.'-'.$i])) { $i += 1; }
				$name = $name.'-'.$i;
			}
			$errors1['rules'][$name] = $rule;
		}
		foreach($errors2['attributes'] as $attribute=>$errors) {
			if(isset($errors1['attributes'][$attribute]))
				$errors1['attributes'][$attribute] = $this->mergeErrors($errors1['attributes'][$attribute], $errors2['attributes'][$attribute]);
			else
				$errors1['attributes'] = $errors2['attributes'];
		}
		return $errors1;
	}
protected function mergeErrors ( array $ errors1 , array $ errors2 ) { foreach ( $ errors2 [ 'rules' ] as $ name => $ rule ) { if ( isset ( $ errors1 [ 'rules' ] [ $ name ] ) ) { $ i = 1 ; while ( isset ( $ errors1 [ 'rules' ] [ $ name . '-' . $ i ] ) ) { $ i += 1 ; } $ name = $ name . '-' . $ i ; } $ errors1 [ 'rules' ] [ $ name ] = $ rule ; } foreach ( $ errors2 [ 'attributes' ] as $ attribute => $ errors ) { if ( isset ( $ errors1 [ 'attributes' ] [ $ attribute ] ) ) $ errors1 [ 'attributes' ] [ $ attribute ] = $ this -> mergeErrors ( $ errors1 [ 'attributes' ] [ $ attribute ] , $ errors2 [ 'attributes' ] [ $ attribute ] ) ; else $ errors1 [ 'attributes' ] = $ errors2 [ 'attributes' ] ; } return $ errors1 ; }
Merge two array of errors.
@param  array  $errors1
@param  array  $errors2
@return array
Merge two array of errors .