Adapter/ShopwareAdapter/RequestGenerator/Product/ProductRequestGenerator.php
private function getImages(Product $product)
    {
        $images = [];
        foreach ($product->getImages() as $image) {
            $shopIdentifiers = array_filter($image->getShopIdentifiers(), function ($shop) {
                $identity = $this->identityService->findOneBy([
                    'objectIdentifier' => (string) $shop,
                    'objectType' => Shop::TYPE,
                    'adapterName' => ShopwareAdapter::NAME,
                ]);

                return $identity !== null;
            });

            if (empty($shopIdentifiers)) {
                continue;
            }

            $imageIdentity = $this->identityService->findOneBy([
                'objectIdentifier' => $image->getMediaIdentifier(),
                'objectType' => Media::TYPE,
                'adapterName' => ShopwareAdapter::NAME,
            ]);

            if (null === $imageIdentity) {
                $this->logger->notice('image is missing - ' . $image->getMediaIdentifier());

                return false;
            }

            $images[] = [
                'mediaId' => $imageIdentity->getAdapterIdentifier(),
                'position' => $image->getPosition(),
            ];
        }

        return $images;
    }
private function getImages(Product $product)
    {
        $images = [];
        foreach ($product->getImages() as $image) {
            $shopIdentifiers = array_filter($image->getShopIdentifiers(), function ($shop) {
                $identity = $this->identityService->findOneBy([
                    'objectIdentifier' => (string) $shop,
                    'objectType' => Shop::TYPE,
                    'adapterName' => ShopwareAdapter::NAME,
                ]);

                return $identity !== null;
            });

            if (empty($shopIdentifiers)) {
                continue;
            }

            $imageIdentity = $this->identityService->findOneBy([
                'objectIdentifier' => $image->getMediaIdentifier(),
                'objectType' => Media::TYPE,
                'adapterName' => ShopwareAdapter::NAME,
            ]);

            if (null === $imageIdentity) {
                $this->logger->notice('image is missing - ' . $image->getMediaIdentifier());

                return false;
            }

            $images[] = [
                'mediaId' => $imageIdentity->getAdapterIdentifier(),
                'position' => $image->getPosition(),
            ];
        }

        return $images;
    }
private function getImages ( Product $ product ) { $ images = [ ] ; foreach ( $ product -> getImages ( ) as $ image ) { $ shopIdentifiers = array_filter ( $ image -> getShopIdentifiers ( ) , function ( $ shop ) { $ identity = $ this -> identityService -> findOneBy ( [ 'objectIdentifier' => ( string ) $ shop , 'objectType' => Shop :: TYPE , 'adapterName' => ShopwareAdapter :: NAME , ] ) ; return $ identity !== null ; } ) ; if ( empty ( $ shopIdentifiers ) ) { continue ; } $ imageIdentity = $ this -> identityService -> findOneBy ( [ 'objectIdentifier' => $ image -> getMediaIdentifier ( ) , 'objectType' => Media :: TYPE , 'adapterName' => ShopwareAdapter :: NAME , ] ) ; if ( null === $ imageIdentity ) { $ this -> logger -> notice ( 'image is missing - ' . $ image -> getMediaIdentifier ( ) ) ; return false ; } $ images [ ] = [ 'mediaId' => $ imageIdentity -> getAdapterIdentifier ( ) , 'position' => $ image -> getPosition ( ) , ] ; } return $ images ; }
@param Product $product

@return array|bool
@param Product $product