|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* (c) shopware AG <[email protected]> |
|
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
5
|
|
|
* file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace ShopwarePlugins\Connect\Components; |
|
9
|
|
|
|
|
10
|
|
|
use Shopware\Bundle\StoreFrontBundle\Struct; |
|
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
interface MediaService |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* Wrapper method of Shopware Core ProductMediaGateway |
|
16
|
|
|
* |
|
17
|
|
|
* @see \Shopware\Bundle\StoreFrontBundle\Gateway\ProductMediaGatewayInterface::getList() |
|
18
|
|
|
* |
|
19
|
|
|
* @param Struct\BaseProduct[] $products |
|
20
|
|
|
* @param Struct\ShopContextInterface $context |
|
21
|
|
|
* @return array Indexed by the product order number. Each element contains a \Shopware\Bundle\StoreFrontBundle\Struct\Media array. |
|
22
|
|
|
*/ |
|
23
|
|
|
public function getProductMediaList(array $products, Struct\ShopContextInterface $context); |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Wrapper method of Shopware Core VariantMediaGateway |
|
27
|
|
|
* |
|
28
|
|
|
* @see \Shopware\Bundle\StoreFrontBundle\Gateway\VariantMediaGatewayInterface::getList() |
|
29
|
|
|
* |
|
30
|
|
|
* @param Struct\BaseProduct[] $products |
|
31
|
|
|
* @param Struct\ShopContextInterface $context |
|
32
|
|
|
* @return array Indexed by product number. Each element contains a \Shopware\Bundle\StoreFrontBundle\Struct\Media array. |
|
33
|
|
|
*/ |
|
34
|
|
|
public function getVariantMediaList(array $products, Struct\ShopContextInterface $context); |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Wrapper method of Shopware Core MediaService |
|
38
|
|
|
* |
|
39
|
|
|
* @see \Shopware\Bundle\StoreFrontBundle\Service\Core\MediaService::getProductsMedia() |
|
40
|
|
|
* |
|
41
|
|
|
* @param Struct\BaseProduct[] $products |
|
42
|
|
|
* @param Struct\ShopContextInterface $context |
|
43
|
|
|
* @return Struct\Media[] |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getProductsMedia($products, Struct\ShopContextInterface $context); |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Wrapper method of Shopware Core MediaService |
|
49
|
|
|
* |
|
50
|
|
|
* @see \Shopware\Bundle\StoreFrontBundle\Service\Core\MediaService::getProductMedia() |
|
51
|
|
|
* |
|
52
|
|
|
* @param Struct\BaseProduct $product |
|
53
|
|
|
* @param Struct\ShopContextInterface $context |
|
54
|
|
|
* @return Struct\Media[] |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getProductMedia($product, Struct\ShopContextInterface $context); |
|
57
|
|
|
} |
|
58
|
|
|
|
Let’s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let’s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: