controller/frontend/src/Controller/Frontend/Basket/Base.php
protected function checkListRef( $prodId, $domain, array $refMap )
	{
		if( empty( $refMap ) ) {
			return;
		}

		$context = $this->getContext();
		$productManager = \Aimeos\MShop::create( $context, 'product' );
		$search = $productManager->createSearch( true );

		$expr = [$search->getConditions()];
		$expr[] = $search->compare( '==', 'product.id', $prodId );

		foreach( $refMap as $listType => $refIds )
		{
			foreach( $refIds as $refId )
			{
				$cmpfunc = $search->createFunction( 'product:has', [$domain, $listType, (string) $refId] );
				$expr[] = $search->compare( '!=', $cmpfunc, null );
			}
		}

		$search->setConditions( $search->combine( '&&', $expr ) );

		if( count( $productManager->searchItems( $search, [] ) ) === 0 )
		{
			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid "%1$s" references for product with ID %2$s' );
			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, json_encode( $prodId ) ) );
		}
	}
protected function checkListRef( $prodId, $domain, array $refMap )
	{
		if( empty( $refMap ) ) {
			return;
		}

		$context = $this->getContext();
		$productManager = \Aimeos\MShop::create( $context, 'product' );
		$search = $productManager->createSearch( true );

		$expr = [$search->getConditions()];
		$expr[] = $search->compare( '==', 'product.id', $prodId );

		foreach( $refMap as $listType => $refIds )
		{
			foreach( $refIds as $refId )
			{
				$cmpfunc = $search->createFunction( 'product:has', [$domain, $listType, (string) $refId] );
				$expr[] = $search->compare( '!=', $cmpfunc, null );
			}
		}

		$search->setConditions( $search->combine( '&&', $expr ) );

		if( count( $productManager->searchItems( $search, [] ) ) === 0 )
		{
			$msg = $context->getI18n()->dt( 'controller/frontend', 'Invalid "%1$s" references for product with ID %2$s' );
			throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( $msg, $domain, json_encode( $prodId ) ) );
		}
	}
protected function checkListRef ( $ prodId , $ domain , array $ refMap ) { if ( empty ( $ refMap ) ) { return ; } $ context = $ this -> getContext ( ) ; $ productManager = \ Aimeos \ MShop :: create ( $ context , 'product' ) ; $ search = $ productManager -> createSearch ( true ) ; $ expr = [ $ search -> getConditions ( ) ] ; $ expr [ ] = $ search -> compare ( '==' , 'product.id' , $ prodId ) ; foreach ( $ refMap as $ listType => $ refIds ) { foreach ( $ refIds as $ refId ) { $ cmpfunc = $ search -> createFunction ( 'product:has' , [ $ domain , $ listType , ( string ) $ refId ] ) ; $ expr [ ] = $ search -> compare ( '!=' , $ cmpfunc , null ) ; } } $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; if ( count ( $ productManager -> searchItems ( $ search , [ ] ) ) === 0 ) { $ msg = $ context -> getI18n ( ) -> dt ( 'controller/frontend' , 'Invalid "%1$s" references for product with ID %2$s' ) ; throw new \ Aimeos \ Controller \ Frontend \ Basket \ Exception ( sprintf ( $ msg , $ domain , json_encode ( $ prodId ) ) ) ; } }
Checks if the reference IDs are really associated to the product

@param string|array $prodId Unique ID of the product or list of product IDs
@param string $domain Domain the references must be of
@param array $refMap Associative list of list type codes as keys and lists of reference IDs as values
@throws \Aimeos\Controller\Frontend\Basket\Exception If one or more of the IDs are not associated
Checks if the reference IDs are really associated to the product