public function merge(Collection $collection) {
		if ($collection->isEmpty()) {
			return $this;
		}
		
		$primary = $this->getPrimary();
		
		if ($primary !== null) {
			$sourcePrimary = $collection->getPrimary();
		
			if ($primary !== $sourcePrimary) {
				$collection = clone $collection;
				$collection->setPrimary($primary);
			}
		}
		
		$data   = &$collection->getDataLinked();
		$models = $collection->getInstancedModels();
		
		if ($primary === null) {
			$this->_data = array_merge($this->_data, $data);
			
			if (! empty($models)) {
				$this->_models = array_merge($this->_models , $models);
			}
		} else {
			$this->_data = $data + $this->_data;
			
			if (! empty($models)) {
				$this->_models = $models + $this->_models;
			}
		}
		
		$this->_pointer = 0;
		$this->_map     = array_keys($this->_data);
		
		return $this;
	}
public function merge(Collection $collection) {
		if ($collection->isEmpty()) {
			return $this;
		}
		
		$primary = $this->getPrimary();
		
		if ($primary !== null) {
			$sourcePrimary = $collection->getPrimary();
		
			if ($primary !== $sourcePrimary) {
				$collection = clone $collection;
				$collection->setPrimary($primary);
			}
		}
		
		$data   = &$collection->getDataLinked();
		$models = $collection->getInstancedModels();
		
		if ($primary === null) {
			$this->_data = array_merge($this->_data, $data);
			
			if (! empty($models)) {
				$this->_models = array_merge($this->_models , $models);
			}
		} else {
			$this->_data = $data + $this->_data;
			
			if (! empty($models)) {
				$this->_models = $models + $this->_models;
			}
		}
		
		$this->_pointer = 0;
		$this->_map     = array_keys($this->_data);
		
		return $this;
	}
public function merge ( Collection $ collection ) { if ( $ collection -> isEmpty ( ) ) { return $ this ; } $ primary = $ this -> getPrimary ( ) ; if ( $ primary !== null ) { $ sourcePrimary = $ collection -> getPrimary ( ) ; if ( $ primary !== $ sourcePrimary ) { $ collection = clone $ collection ; $ collection -> setPrimary ( $ primary ) ; } } $ data = & $ collection -> getDataLinked ( ) ; $ models = $ collection -> getInstancedModels ( ) ; if ( $ primary === null ) { $ this -> _data = array_merge ( $ this -> _data , $ data ) ; if ( ! empty ( $ models ) ) { $ this -> _models = array_merge ( $ this -> _models , $ models ) ; } } else { $ this -> _data = $ data + $ this -> _data ; if ( ! empty ( $ models ) ) { $ this -> _models = $ models + $ this -> _models ; } } $ this -> _pointer = 0 ; $ this -> _map = array_keys ( $ this -> _data ) ; return $ this ; }
Merge a collection into this collection

@param  Collection $collection
@return Collection
Merge a collection into this collection