protected function _addLocaleSiteData( MShop_Common_Manager_Interface $localeManager, array $data, $manager = 'Default', $parentId = null )
	{
		$this->_msg( 'Adding data for MShop locale sites', 1 );

		$localeSiteManager = $localeManager->getSubManager( 'site', $manager );
		$siteItem = $localeSiteManager->createItem();
		$siteIds = array();

		foreach( $data as $key => $dataset )
		{
			try
			{
				$siteItem->setId( null );
				$siteItem->setCode( $dataset['code'] );
				$siteItem->setLabel( $dataset['label'] );
				$siteItem->setConfig( $dataset['config'] );
				$siteItem->setStatus( $dataset['status'] );

				$localeSiteManager->insertItem( $siteItem, $parentId );
				$siteIds[$key] = $siteItem->getId();
			}
			catch( Exception $e )
			{
				$search = $localeSiteManager->createSearch();
				$search->setConditions( $search->compare( '==', 'locale.site.code', $dataset['code'] ) );
				$result = $localeSiteManager->searchItems( $search );

				if( ( $item = reset( $result ) ) === false ) {
					throw new Exception( sprintf( 'No site for code "%1$s" available', $dataset['code'] ) );
				}

				$siteIds[$key] = $item->getId();
			}
		}

		$this->_status( 'done' );

		return $siteIds;
	}
protected function _addLocaleSiteData( MShop_Common_Manager_Interface $localeManager, array $data, $manager = 'Default', $parentId = null )
	{
		$this->_msg( 'Adding data for MShop locale sites', 1 );

		$localeSiteManager = $localeManager->getSubManager( 'site', $manager );
		$siteItem = $localeSiteManager->createItem();
		$siteIds = array();

		foreach( $data as $key => $dataset )
		{
			try
			{
				$siteItem->setId( null );
				$siteItem->setCode( $dataset['code'] );
				$siteItem->setLabel( $dataset['label'] );
				$siteItem->setConfig( $dataset['config'] );
				$siteItem->setStatus( $dataset['status'] );

				$localeSiteManager->insertItem( $siteItem, $parentId );
				$siteIds[$key] = $siteItem->getId();
			}
			catch( Exception $e )
			{
				$search = $localeSiteManager->createSearch();
				$search->setConditions( $search->compare( '==', 'locale.site.code', $dataset['code'] ) );
				$result = $localeSiteManager->searchItems( $search );

				if( ( $item = reset( $result ) ) === false ) {
					throw new Exception( sprintf( 'No site for code "%1$s" available', $dataset['code'] ) );
				}

				$siteIds[$key] = $item->getId();
			}
		}

		$this->_status( 'done' );

		return $siteIds;
	}
protected function _addLocaleSiteData ( MShop_Common_Manager_Interface $ localeManager , array $ data , $ manager = 'Default' , $ parentId = null ) { $ this -> _msg ( 'Adding data for MShop locale sites' , 1 ) ; $ localeSiteManager = $ localeManager -> getSubManager ( 'site' , $ manager ) ; $ siteItem = $ localeSiteManager -> createItem ( ) ; $ siteIds = array ( ) ; foreach ( $ data as $ key => $ dataset ) { try { $ siteItem -> setId ( null ) ; $ siteItem -> setCode ( $ dataset [ 'code' ] ) ; $ siteItem -> setLabel ( $ dataset [ 'label' ] ) ; $ siteItem -> setConfig ( $ dataset [ 'config' ] ) ; $ siteItem -> setStatus ( $ dataset [ 'status' ] ) ; $ localeSiteManager -> insertItem ( $ siteItem , $ parentId ) ; $ siteIds [ $ key ] = $ siteItem -> getId ( ) ; } catch ( Exception $ e ) { $ search = $ localeSiteManager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '==' , 'locale.site.code' , $ dataset [ 'code' ] ) ) ; $ result = $ localeSiteManager -> searchItems ( $ search ) ; if ( ( $ item = reset ( $ result ) ) === false ) { throw new Exception ( sprintf ( 'No site for code "%1$s" available' , $ dataset [ 'code' ] ) ) ; } $ siteIds [ $ key ] = $ item -> getId ( ) ; } } $ this -> _status ( 'done' ) ; return $ siteIds ; }
Adds locale site data.

@param MShop_Common_Manager_Interface $localeManager Locale manager
@param array $data Associative list of locale site data
@param string $manager Manager implementation name
@param integer|null $parentId Parent id of the locale item
@return array Associative list of keys from the data and generated site ID
Adds locale site data .