protected function _buildItems( array $map, array $domains, $prefix )
	{
		$items = $listItemMap = $refItemMap = $refIdMap = array();

		if( count( $domains ) > 0 )
		{
			$listItems = $this->_getListItems( array_keys( $map ), $domains, $prefix );

			foreach( $listItems as $listItem )
			{
				$domain = $listItem->getDomain();
				$parentid = $listItem->getParentId();

				$listItemMap[ $parentid ][ $domain ][ $listItem->getId() ] = $listItem;
				$refIdMap[ $domain ][ $listItem->getRefId() ][] = $parentid;
			}

			$refItemMap = $this->_getRefItems( $refIdMap );
		}

		foreach ( $map as $id => $values )
		{
			$listItems = array();
			if ( isset( $listItemMap[$id] ) ) {
				$listItems = $listItemMap[$id];
			}

			$refItems = array();
			if ( isset( $refItemMap[$id] ) ) {
				$refItems = $refItemMap[$id];
			}

			$items[ $id ] = $this->_createItem( $values, $listItems, $refItems );
		}

		return $items;
	}
protected function _buildItems( array $map, array $domains, $prefix )
	{
		$items = $listItemMap = $refItemMap = $refIdMap = array();

		if( count( $domains ) > 0 )
		{
			$listItems = $this->_getListItems( array_keys( $map ), $domains, $prefix );

			foreach( $listItems as $listItem )
			{
				$domain = $listItem->getDomain();
				$parentid = $listItem->getParentId();

				$listItemMap[ $parentid ][ $domain ][ $listItem->getId() ] = $listItem;
				$refIdMap[ $domain ][ $listItem->getRefId() ][] = $parentid;
			}

			$refItemMap = $this->_getRefItems( $refIdMap );
		}

		foreach ( $map as $id => $values )
		{
			$listItems = array();
			if ( isset( $listItemMap[$id] ) ) {
				$listItems = $listItemMap[$id];
			}

			$refItems = array();
			if ( isset( $refItemMap[$id] ) ) {
				$refItems = $refItemMap[$id];
			}

			$items[ $id ] = $this->_createItem( $values, $listItems, $refItems );
		}

		return $items;
	}
protected function _buildItems ( array $ map , array $ domains , $ prefix ) { $ items = $ listItemMap = $ refItemMap = $ refIdMap = array ( ) ; if ( count ( $ domains ) > 0 ) { $ listItems = $ this -> _getListItems ( array_keys ( $ map ) , $ domains , $ prefix ) ; foreach ( $ listItems as $ listItem ) { $ domain = $ listItem -> getDomain ( ) ; $ parentid = $ listItem -> getParentId ( ) ; $ listItemMap [ $ parentid ] [ $ domain ] [ $ listItem -> getId ( ) ] = $ listItem ; $ refIdMap [ $ domain ] [ $ listItem -> getRefId ( ) ] [ ] = $ parentid ; } $ refItemMap = $ this -> _getRefItems ( $ refIdMap ) ; } foreach ( $ map as $ id => $ values ) { $ listItems = array ( ) ; if ( isset ( $ listItemMap [ $ id ] ) ) { $ listItems = $ listItemMap [ $ id ] ; } $ refItems = array ( ) ; if ( isset ( $ refItemMap [ $ id ] ) ) { $ refItems = $ refItemMap [ $ id ] ; } $ items [ $ id ] = $ this -> _createItem ( $ values , $ listItems , $ refItems ) ; } return $ items ; }
Creates the items with address item, list items and referenced items.

@param array $map Associative list of IDs as keys and the associative array of values
@param array $domains List of domains to fetch list items and referenced items for
@param string $prefix Domain prefix
@return array List of items implementing MShop_Common_Item_Interface
Creates the items with address item list items and referenced items .