protected function _removeListItems( $parentid, $name, $refdomain )
	{
		$start = 0;
		$context =  $this->_getContext();
		$key = str_replace( '/', '.', $name );

		$manager = MShop_Factory::createManager( $context, $refdomain );
		$listManager = MShop_Factory::createManager( $context, $name );


		$search = $listManager->createSearch();
		$expr = array(
			$search->compare( '==', $key . '.parentid', $parentid ),
			$search->compare( '==', $key . '.domain', $refdomain ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		do
		{
			$refIds = $listIds = $map = array();
			$result = $listManager->searchItems( $search );

			foreach( $result as $id => $listItem )
			{
				$refIds[] = $listItem->getRefId();
				$map[ $listItem->getRefId() ][] = $id;
			}


			$search = $manager->createSearch();
			$search->setConditions( $search->compare( '==', $refdomain . '.id', $refIds ) );
			$ids = array_keys( $manager->searchItems( $search ) );

			foreach( array_diff( $refIds, $ids ) as $refId ) {
				$listIds = array_merge( $listIds, $map[$refId] );
			}

			$listManager->deleteItems( $listIds );


			$count = count( $result );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count == $search->getSliceSize() );


		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '=~', $refdomain . '.label', 'Demo' ) );
		$ids = array_keys( $manager->searchItems( $search ) );

		$search = $listManager->createSearch();
		$expr = array(
			$search->compare( '==', $key . '.parentid', $parentid ),
			$search->compare( '==', $key . '.refid', $ids ),
			$search->compare( '==', $key . '.domain', $refdomain ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		$listManager->deleteItems( array_keys( $listManager->searchItems( $search ) ) );
	}
protected function _removeListItems( $parentid, $name, $refdomain )
	{
		$start = 0;
		$context =  $this->_getContext();
		$key = str_replace( '/', '.', $name );

		$manager = MShop_Factory::createManager( $context, $refdomain );
		$listManager = MShop_Factory::createManager( $context, $name );


		$search = $listManager->createSearch();
		$expr = array(
			$search->compare( '==', $key . '.parentid', $parentid ),
			$search->compare( '==', $key . '.domain', $refdomain ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		do
		{
			$refIds = $listIds = $map = array();
			$result = $listManager->searchItems( $search );

			foreach( $result as $id => $listItem )
			{
				$refIds[] = $listItem->getRefId();
				$map[ $listItem->getRefId() ][] = $id;
			}


			$search = $manager->createSearch();
			$search->setConditions( $search->compare( '==', $refdomain . '.id', $refIds ) );
			$ids = array_keys( $manager->searchItems( $search ) );

			foreach( array_diff( $refIds, $ids ) as $refId ) {
				$listIds = array_merge( $listIds, $map[$refId] );
			}

			$listManager->deleteItems( $listIds );


			$count = count( $result );
			$start += $count;
			$search->setSlice( $start );
		}
		while( $count == $search->getSliceSize() );


		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '=~', $refdomain . '.label', 'Demo' ) );
		$ids = array_keys( $manager->searchItems( $search ) );

		$search = $listManager->createSearch();
		$expr = array(
			$search->compare( '==', $key . '.parentid', $parentid ),
			$search->compare( '==', $key . '.refid', $ids ),
			$search->compare( '==', $key . '.domain', $refdomain ),
		);
		$search->setConditions( $search->combine( '&&', $expr ) );

		$listManager->deleteItems( array_keys( $listManager->searchItems( $search ) ) );
	}
protected function _removeListItems ( $ parentid , $ name , $ refdomain ) { $ start = 0 ; $ context = $ this -> _getContext ( ) ; $ key = str_replace ( '/' , '.' , $ name ) ; $ manager = MShop_Factory :: createManager ( $ context , $ refdomain ) ; $ listManager = MShop_Factory :: createManager ( $ context , $ name ) ; $ search = $ listManager -> createSearch ( ) ; $ expr = array ( $ search -> compare ( '==' , $ key . '.parentid' , $ parentid ) , $ search -> compare ( '==' , $ key . '.domain' , $ refdomain ) , ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; do { $ refIds = $ listIds = $ map = array ( ) ; $ result = $ listManager -> searchItems ( $ search ) ; foreach ( $ result as $ id => $ listItem ) { $ refIds [ ] = $ listItem -> getRefId ( ) ; $ map [ $ listItem -> getRefId ( ) ] [ ] = $ id ; } $ search = $ manager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '==' , $ refdomain . '.id' , $ refIds ) ) ; $ ids = array_keys ( $ manager -> searchItems ( $ search ) ) ; foreach ( array_diff ( $ refIds , $ ids ) as $ refId ) { $ listIds = array_merge ( $ listIds , $ map [ $ refId ] ) ; } $ listManager -> deleteItems ( $ listIds ) ; $ count = count ( $ result ) ; $ start += $ count ; $ search -> setSlice ( $ start ) ; } while ( $ count == $ search -> getSliceSize ( ) ) ; $ search = $ manager -> createSearch ( ) ; $ search -> setConditions ( $ search -> compare ( '=~' , $ refdomain . '.label' , 'Demo' ) ) ; $ ids = array_keys ( $ manager -> searchItems ( $ search ) ) ; $ search = $ listManager -> createSearch ( ) ; $ expr = array ( $ search -> compare ( '==' , $ key . '.parentid' , $ parentid ) , $ search -> compare ( '==' , $ key . '.refid' , $ ids ) , $ search -> compare ( '==' , $ key . '.domain' , $ refdomain ) , ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ listManager -> deleteItems ( array_keys ( $ listManager -> searchItems ( $ search ) ) ) ; }
Deletes the references to non-existent or demo items in the database.

@param string $parentid ID of the parent item where the associated items should be removed from
@param string $name Name of the list manager, e.g. 'catalog/list'
@param string $refdomain Name of the domain to remove the items from, e.g. 'product'
Deletes the references to non - existent or demo items in the database .