diff --git a/UPGRADE-API-1.11.md b/UPGRADE-API-1.11.md
index a91c90097f..1917823ee4 100644
--- a/UPGRADE-API-1.11.md
+++ b/UPGRADE-API-1.11.md
@@ -14,6 +14,7 @@
+ "media_path": "/media/image/uo/product.jpg"
}
```
+
To change the prefix you need to set parameter in ``app/config/packages/_sylius.yaml``:
```yaml
diff --git a/src/Sylius/Bundle/ApiBundle/Doctrine/Filters/ExchangeRateFilter.php b/src/Sylius/Bundle/ApiBundle/Doctrine/Filter/ExchangeRateFilter.php
similarity index 96%
rename from src/Sylius/Bundle/ApiBundle/Doctrine/Filters/ExchangeRateFilter.php
rename to src/Sylius/Bundle/ApiBundle/Doctrine/Filter/ExchangeRateFilter.php
index a1dfd69f20..ade75a9211 100644
--- a/src/Sylius/Bundle/ApiBundle/Doctrine/Filters/ExchangeRateFilter.php
+++ b/src/Sylius/Bundle/ApiBundle/Doctrine/Filter/ExchangeRateFilter.php
@@ -11,7 +11,7 @@
declare(strict_types=1);
-namespace Sylius\Bundle\ApiBundle\Doctrine\Filters;
+namespace Sylius\Bundle\ApiBundle\Doctrine\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Util\QueryNameGeneratorInterface;
diff --git a/src/Sylius/Bundle/ApiBundle/Doctrine/Filters/TranslationOrderNameAndLocaleFilter.php b/src/Sylius/Bundle/ApiBundle/Doctrine/Filter/TranslationOrderNameAndLocaleFilter.php
similarity index 98%
rename from src/Sylius/Bundle/ApiBundle/Doctrine/Filters/TranslationOrderNameAndLocaleFilter.php
rename to src/Sylius/Bundle/ApiBundle/Doctrine/Filter/TranslationOrderNameAndLocaleFilter.php
index 6397751756..705cfbcf3b 100644
--- a/src/Sylius/Bundle/ApiBundle/Doctrine/Filters/TranslationOrderNameAndLocaleFilter.php
+++ b/src/Sylius/Bundle/ApiBundle/Doctrine/Filter/TranslationOrderNameAndLocaleFilter.php
@@ -11,7 +11,7 @@
declare(strict_types=1);
-namespace Sylius\Bundle\ApiBundle\Doctrine\Filters;
+namespace Sylius\Bundle\ApiBundle\Doctrine\Filter;
use ApiPlatform\Core\Bridge\Doctrine\Common\Filter\OrderFilterInterface;
use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\AbstractContextAwareFilter;
diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml
index c9fe1c75b6..3441aaba28 100644
--- a/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml
+++ b/src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml
@@ -97,12 +97,12 @@
-
+
-
+
diff --git a/src/Sylius/Bundle/ApiBundle/Resources/config/services/serializers.xml b/src/Sylius/Bundle/ApiBundle/Resources/config/services/serializers.xml
index b09b0cb522..d28b17cd71 100644
--- a/src/Sylius/Bundle/ApiBundle/Resources/config/services/serializers.xml
+++ b/src/Sylius/Bundle/ApiBundle/Resources/config/services/serializers.xml
@@ -36,6 +36,11 @@
+
+ %sylius_api.product_image_prefix%
+
+
+
diff --git a/src/Sylius/Bundle/ApiBundle/Serializer/ProductImageNormalizer.php b/src/Sylius/Bundle/ApiBundle/Serializer/ProductImageNormalizer.php
index 13c2956edb..85fee35dd9 100644
--- a/src/Sylius/Bundle/ApiBundle/Serializer/ProductImageNormalizer.php
+++ b/src/Sylius/Bundle/ApiBundle/Serializer/ProductImageNormalizer.php
@@ -9,6 +9,8 @@
* file that was distributed with this source code.
*/
+declare(strict_types=1);
+
namespace Sylius\Bundle\ApiBundle\Serializer;
use Sylius\Component\Core\Model\ProductImageInterface;
@@ -32,7 +34,7 @@ class ProductImageNormalizer implements ContextAwareNormalizerInterface, Normali
$this->prefix = $this->validatePrefix($prefix);
}
- public function normalize($object, string $format = null, array $context = [])
+ public function normalize($object, $format = null, array $context = [])
{
Assert::isInstanceOf($object, ProductImageInterface::class);
Assert::keyNotExists($context, self::ALREADY_CALLED);
@@ -46,7 +48,7 @@ class ProductImageNormalizer implements ContextAwareNormalizerInterface, Normali
return $data;
}
- public function supportsNormalization($data, string $format = null, array $context = []): bool
+ public function supportsNormalization($data, $format = null, $context = []): bool
{
if (isset($context[self::ALREADY_CALLED])) {
return false;
@@ -57,7 +59,7 @@ class ProductImageNormalizer implements ContextAwareNormalizerInterface, Normali
private function validatePrefix(string $prefix): string
{
- if ('/' !== substr($prefix, 0)) {
+ if ('/' !== substr($prefix, 0, 1)) {
$prefix = '/'.$prefix;
}