public function setDataLinked(array &$data) {
		$this->_data   = [];
		$this->_models = [];
		
		$modelClass = $this->getModel();
		
		foreach ($data as $key => &$item) {
			if (is_object($item)) {
				if (! $item instanceof $modelClass) {
					throw new Exception('Model must be an instance of "' . $modelClass . '"');
				}
				
				$this->_data[$key]   = &$item->getDataLinked();
				$this->_models[$key] = $item;
			}
			elseif (is_array($item)) {
				$this->_data[$key] = &$item;
			}
			else {
				throw new Exception('Unknown type of item: "' . gettype($item) . '"');
			}
		}
		unset($item);
		
		$this->_pointer = 0;
		$this->_map     = array_keys($this->_data);
		
		return $this;
	}
public function setDataLinked(array &$data) {
		$this->_data   = [];
		$this->_models = [];
		
		$modelClass = $this->getModel();
		
		foreach ($data as $key => &$item) {
			if (is_object($item)) {
				if (! $item instanceof $modelClass) {
					throw new Exception('Model must be an instance of "' . $modelClass . '"');
				}
				
				$this->_data[$key]   = &$item->getDataLinked();
				$this->_models[$key] = $item;
			}
			elseif (is_array($item)) {
				$this->_data[$key] = &$item;
			}
			else {
				throw new Exception('Unknown type of item: "' . gettype($item) . '"');
			}
		}
		unset($item);
		
		$this->_pointer = 0;
		$this->_map     = array_keys($this->_data);
		
		return $this;
	}
public function setDataLinked ( array & $ data ) { $ this -> _data = [ ] ; $ this -> _models = [ ] ; $ modelClass = $ this -> getModel ( ) ; foreach ( $ data as $ key => & $ item ) { if ( is_object ( $ item ) ) { if ( ! $ item instanceof $ modelClass ) { throw new Exception ( 'Model must be an instance of "' . $ modelClass . '"' ) ; } $ this -> _data [ $ key ] = & $ item -> getDataLinked ( ) ; $ this -> _models [ $ key ] = $ item ; } elseif ( is_array ( $ item ) ) { $ this -> _data [ $ key ] = & $ item ; } else { throw new Exception ( 'Unknown type of item: "' . gettype ( $ item ) . '"' ) ; } } unset ( $ item ) ; $ this -> _pointer = 0 ; $ this -> _map = array_keys ( $ this -> _data ) ; return $ this ; }
Set linked collection's data

@param  array $data
@return Collection
Set linked collection s data