private function _initMany($property, $method, $mode, $sourcePrimary) {
		$collection = $this->getCollection();
		
		$data = $collection->__call($method);
		if ($data === null) return;

		if ($data instanceof Collection) {
			if ($data->hasMetadata()) {
				$meta = $data->getMetadata();

				$onProperty     = $meta->joinOnProperty;
				$sourceProperty = $meta->joinOnSource;
			} else {
				$onProperty     = null;
				$sourceProperty = null;
			}

			if ($mode === self::MODE_CASCADE) {
				// If not specified in meta, using a requested property
				if ($onProperty === null) {
					$onProperty = $property;
				}

				// If not specified in meta:
				if ($sourceProperty === null) {
					if ($sourcePrimary === null) {
						// Attempt to get from source collection
						$sourceProperty = $data->getPrimary();

						if ($sourceProperty === null) {
							throw new Exception('Unable to determine a source property for join');
						}
					} else {
						// Manually specified
						$sourceProperty = $sourcePrimary;
					}
				}
			}

			if ($mode === self::MODE_JOIN) {
				$collection->join($data, $onProperty, $sourceProperty);
			}
			else if ($mode === self::MODE_CASCADE || $mode === self::MODE_CASCADE_MANY) {
				$collection->setList($onProperty, $data->toArray(), $sourceProperty);
			}
			else {
				throw new Exception('Uncnown loading mode');
			}
		} else {
			throw new Exception('Data must be represented as a collection');
		}
	}
private function _initMany($property, $method, $mode, $sourcePrimary) {
		$collection = $this->getCollection();
		
		$data = $collection->__call($method);
		if ($data === null) return;

		if ($data instanceof Collection) {
			if ($data->hasMetadata()) {
				$meta = $data->getMetadata();

				$onProperty     = $meta->joinOnProperty;
				$sourceProperty = $meta->joinOnSource;
			} else {
				$onProperty     = null;
				$sourceProperty = null;
			}

			if ($mode === self::MODE_CASCADE) {
				// If not specified in meta, using a requested property
				if ($onProperty === null) {
					$onProperty = $property;
				}

				// If not specified in meta:
				if ($sourceProperty === null) {
					if ($sourcePrimary === null) {
						// Attempt to get from source collection
						$sourceProperty = $data->getPrimary();

						if ($sourceProperty === null) {
							throw new Exception('Unable to determine a source property for join');
						}
					} else {
						// Manually specified
						$sourceProperty = $sourcePrimary;
					}
				}
			}

			if ($mode === self::MODE_JOIN) {
				$collection->join($data, $onProperty, $sourceProperty);
			}
			else if ($mode === self::MODE_CASCADE || $mode === self::MODE_CASCADE_MANY) {
				$collection->setList($onProperty, $data->toArray(), $sourceProperty);
			}
			else {
				throw new Exception('Uncnown loading mode');
			}
		} else {
			throw new Exception('Data must be represented as a collection');
		}
	}
private function _initMany ( $ property , $ method , $ mode , $ sourcePrimary ) { $ collection = $ this -> getCollection ( ) ; $ data = $ collection -> __call ( $ method ) ; if ( $ data === null ) return ; if ( $ data instanceof Collection ) { if ( $ data -> hasMetadata ( ) ) { $ meta = $ data -> getMetadata ( ) ; $ onProperty = $ meta -> joinOnProperty ; $ sourceProperty = $ meta -> joinOnSource ; } else { $ onProperty = null ; $ sourceProperty = null ; } if ( $ mode === self :: MODE_CASCADE ) { // If not specified in meta, using a requested property
 if ( $ onProperty === null ) { $ onProperty = $ property ; } // If not specified in meta:
 if ( $ sourceProperty === null ) { if ( $ sourcePrimary === null ) { // Attempt to get from source collection
 $ sourceProperty = $ data -> getPrimary ( ) ; if ( $ sourceProperty === null ) { throw new Exception ( 'Unable to determine a source property for join' ) ; } } else { // Manually specified
 $ sourceProperty = $ sourcePrimary ; } } } if ( $ mode === self :: MODE_JOIN ) { $ collection -> join ( $ data , $ onProperty , $ sourceProperty ) ; } else if ( $ mode === self :: MODE_CASCADE || $ mode === self :: MODE_CASCADE_MANY ) { $ collection -> setList ( $ onProperty , $ data -> toArray ( ) , $ sourceProperty ) ; } else { throw new Exception ( 'Uncnown loading mode' ) ; } } else { throw new Exception ( 'Data must be represented as a collection' ) ; } }
Get a data for all models in a collection

@param  string $property
@param  string $method
@param  int    $mode
@param  string $sourcePrimary
@throws Exception
Get a data for all models in a collection