public function join(Collection $collection, $onProperty = null, $sourceProperty = null) {
		if ($collection->isEmpty()) {
			return $this;
		}
		
		$sourcePrimary = $collection->getPrimary();
		
		if ($onProperty === null) {
			if ($sourcePrimary === null) {
				throw new Exception('Unable to determine a property for join');
			} else {
				$onProperty = $sourcePrimary;
			}
		}
		
		if ($sourceProperty === null) {
			$sourceProperty = $onProperty;
		}

		if ($sourceProperty !== $sourcePrimary) {
			$collection = clone $collection;
			$collection->setPrimary($sourceProperty);
		}
		
		$source = &$collection->getDataLinked();

		foreach ($this->_data as &$item) {
			if (isset($item[$onProperty], $source[$item[$onProperty]])) {
				$item += $source[$item[$onProperty]];
			}
		}
		unset($item, $source);
		
		return $this;
	}
public function join(Collection $collection, $onProperty = null, $sourceProperty = null) {
		if ($collection->isEmpty()) {
			return $this;
		}
		
		$sourcePrimary = $collection->getPrimary();
		
		if ($onProperty === null) {
			if ($sourcePrimary === null) {
				throw new Exception('Unable to determine a property for join');
			} else {
				$onProperty = $sourcePrimary;
			}
		}
		
		if ($sourceProperty === null) {
			$sourceProperty = $onProperty;
		}

		if ($sourceProperty !== $sourcePrimary) {
			$collection = clone $collection;
			$collection->setPrimary($sourceProperty);
		}
		
		$source = &$collection->getDataLinked();

		foreach ($this->_data as &$item) {
			if (isset($item[$onProperty], $source[$item[$onProperty]])) {
				$item += $source[$item[$onProperty]];
			}
		}
		unset($item, $source);
		
		return $this;
	}
public function join ( Collection $ collection , $ onProperty = null , $ sourceProperty = null ) { if ( $ collection -> isEmpty ( ) ) { return $ this ; } $ sourcePrimary = $ collection -> getPrimary ( ) ; if ( $ onProperty === null ) { if ( $ sourcePrimary === null ) { throw new Exception ( 'Unable to determine a property for join' ) ; } else { $ onProperty = $ sourcePrimary ; } } if ( $ sourceProperty === null ) { $ sourceProperty = $ onProperty ; } if ( $ sourceProperty !== $ sourcePrimary ) { $ collection = clone $ collection ; $ collection -> setPrimary ( $ sourceProperty ) ; } $ source = & $ collection -> getDataLinked ( ) ; foreach ( $ this -> _data as & $ item ) { if ( isset ( $ item [ $ onProperty ] , $ source [ $ item [ $ onProperty ] ] ) ) { $ item += $ source [ $ item [ $ onProperty ] ] ; } } unset ( $ item , $ source ) ; return $ this ; }
Merge items of source collection into items of this collection

@param  Collection $collection
@param  string $primarySource
@param  string $primaryDest
@throws Exception
@return Collection
Merge items of source collection into items of this collection