public function setPrimary($primaryName) {
		if (is_array($primaryName)) {
			$idProperty = self::COMPOSITE_ID_PROPERTY . $this->_collectionId;
			
			foreach ($this->_data as &$dataPart) {
				$dataHashParts = [];
				
				foreach ($primaryName as $keyPart) {
					if (! isset($dataPart[$keyPart])) {
						throw new Exception('Undefined property can\'t been used as a part of a composite primary');
					}
					
					$dataHashParts[] = $dataPart[$keyPart];
				}
				
				$dataPart[$idProperty] = $this->arrayHashFunction($dataHashParts);
			}
			unset($dataPart);
			
			$this->_primaryDefinition = $primaryName;
			
			$primaryName = $idProperty;
		} else {
			$this->_primaryDefinition = $primaryName;
		}
		
		$tempData = $this->_data;
		$this->_data = [];
		
		foreach ($tempData as &$item) {
			if (! isset($item[$primaryName])) {
				throw new Exception('Undefined property can\'t been used as a primary');
			}
			
			$this->_data[$item[$primaryName]] = &$item;
		}
		unset($item, $tempData);
		
		if (! empty($this->_models)) {
			$tempData = $this->_models;
			$this->_models = [];
			
			foreach ($tempData as $item) {
				$this->_models[$item->$primaryName] = $item;
			}
			
			unset($tempData);
		}
		
		$this->_pointer = 0;
		$this->_map     = array_keys($this->_data);
		$this->_primary = $primaryName;
		
		return $this;
	}