public function searchItems( MW_Common_Criteria_Interface $search, array $ref = array(), &$total = null )
	{
		$items = $map = $typeIds = array();

		$dbm = $this->_getContext()->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$domain = explode( '.', $this->_prefix );

			if ( ( $topdomain = array_shift( $domain ) ) === null ) {
				throw new MShop_Exception( sprintf( 'Configuration not available' ) );
			}

			$level = MShop_Locale_Manager_Abstract::SITE_ALL;
			$cfgPathSearch = $this->_configPath . 'search';
			$cfgPathCount =  $this->_configPath . 'count';

			$name = trim( $this->_prefix, '.' );
			$required = array( $name );

			$results = $this->_searchItems( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );

			while( ( $row = $results->fetch() ) !== false )
			{
				if ( ( $row['config'] = json_decode( $row['config'], true ) ) === null ) {
					$row['config'] = array();
				}

				$map[ $row['id'] ] = $row;
				$typeIds[ $row['typeid'] ] = null;
			}

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}

		if( !empty( $typeIds ) )
		{
			$typeManager = $this->getSubManager( 'type' );
			$typeSearch = $typeManager->createSearch();
			$typeSearch->setConditions( $typeSearch->compare( '==', $name . '.type.id', array_keys( $typeIds ) ) );
			$typeSearch->setSlice( 0, $search->getSliceSize() );
			$typeItems = $typeManager->searchItems( $typeSearch );

			foreach( $map as $id => $row )
			{
				if( isset( $typeItems[ $row['typeid'] ] ) ) {
					$row['type'] = $typeItems[ $row['typeid'] ]->getCode();
				}
				$items[ $row['id'] ] = $this->_createItem( $row );
			}
		}

		return $items;
	}
public function searchItems( MW_Common_Criteria_Interface $search, array $ref = array(), &$total = null )
	{
		$items = $map = $typeIds = array();

		$dbm = $this->_getContext()->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$domain = explode( '.', $this->_prefix );

			if ( ( $topdomain = array_shift( $domain ) ) === null ) {
				throw new MShop_Exception( sprintf( 'Configuration not available' ) );
			}

			$level = MShop_Locale_Manager_Abstract::SITE_ALL;
			$cfgPathSearch = $this->_configPath . 'search';
			$cfgPathCount =  $this->_configPath . 'count';

			$name = trim( $this->_prefix, '.' );
			$required = array( $name );

			$results = $this->_searchItems( $conn, $search, $cfgPathSearch, $cfgPathCount, $required, $total, $level );

			while( ( $row = $results->fetch() ) !== false )
			{
				if ( ( $row['config'] = json_decode( $row['config'], true ) ) === null ) {
					$row['config'] = array();
				}

				$map[ $row['id'] ] = $row;
				$typeIds[ $row['typeid'] ] = null;
			}

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}

		if( !empty( $typeIds ) )
		{
			$typeManager = $this->getSubManager( 'type' );
			$typeSearch = $typeManager->createSearch();
			$typeSearch->setConditions( $typeSearch->compare( '==', $name . '.type.id', array_keys( $typeIds ) ) );
			$typeSearch->setSlice( 0, $search->getSliceSize() );
			$typeItems = $typeManager->searchItems( $typeSearch );

			foreach( $map as $id => $row )
			{
				if( isset( $typeItems[ $row['typeid'] ] ) ) {
					$row['type'] = $typeItems[ $row['typeid'] ]->getCode();
				}
				$items[ $row['id'] ] = $this->_createItem( $row );
			}
		}

		return $items;
	}
public function searchItems ( MW_Common_Criteria_Interface $ search , array $ ref = array ( ) , & $ total = null ) { $ items = $ map = $ typeIds = array ( ) ; $ dbm = $ this -> _getContext ( ) -> getDatabaseManager ( ) ; $ dbname = $ this -> _getResourceName ( ) ; $ conn = $ dbm -> acquire ( $ dbname ) ; try { $ domain = explode ( '.' , $ this -> _prefix ) ; if ( ( $ topdomain = array_shift ( $ domain ) ) === null ) { throw new MShop_Exception ( sprintf ( 'Configuration not available' ) ) ; } $ level = MShop_Locale_Manager_Abstract :: SITE_ALL ; $ cfgPathSearch = $ this -> _configPath . 'search' ; $ cfgPathCount = $ this -> _configPath . 'count' ; $ name = trim ( $ this -> _prefix , '.' ) ; $ required = array ( $ name ) ; $ results = $ this -> _searchItems ( $ conn , $ search , $ cfgPathSearch , $ cfgPathCount , $ required , $ total , $ level ) ; while ( ( $ row = $ results -> fetch ( ) ) !== false ) { if ( ( $ row [ 'config' ] = json_decode ( $ row [ 'config' ] , true ) ) === null ) { $ row [ 'config' ] = array ( ) ; } $ map [ $ row [ 'id' ] ] = $ row ; $ typeIds [ $ row [ 'typeid' ] ] = null ; } $ dbm -> release ( $ conn , $ dbname ) ; } catch ( Exception $ e ) { $ dbm -> release ( $ conn , $ dbname ) ; throw $ e ; } if ( ! empty ( $ typeIds ) ) { $ typeManager = $ this -> getSubManager ( 'type' ) ; $ typeSearch = $ typeManager -> createSearch ( ) ; $ typeSearch -> setConditions ( $ typeSearch -> compare ( '==' , $ name . '.type.id' , array_keys ( $ typeIds ) ) ) ; $ typeSearch -> setSlice ( 0 , $ search -> getSliceSize ( ) ) ; $ typeItems = $ typeManager -> searchItems ( $ typeSearch ) ; foreach ( $ map as $ id => $ row ) { if ( isset ( $ typeItems [ $ row [ 'typeid' ] ] ) ) { $ row [ 'type' ] = $ typeItems [ $ row [ 'typeid' ] ] -> getCode ( ) ; } $ items [ $ row [ 'id' ] ] = $ this -> _createItem ( $ row ) ; } } return $ items ; }
Search for all list items based on the given critera.

@param MW_Common_Criteria_Interface $search Search object with search conditions
@param array $ref List of domains to fetch referenced items for
@param integer &$total Number of items that are available in total
@return array List of list items implementing MShop_Common_Item_List_Interface
@throws MShop_Exception if creating items failed
@see MW_Common_Criteria_SQL
Search for all list items based on the given critera .