From fb5d81fd84c92454b68c206a1127874a1322c7ce Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 11 Apr 2022 11:05:25 +0200 Subject: [PATCH 1/4] Remove deprecation (#44) --- spec/Converter/ValueConverterSpec.php | 17 +---- src/Controller/ProductEnqueueController.php | 25 +----- src/Converter/ValueConverter.php | 20 +---- .../WebgriffeSyliusAkeneoExtension.php | 76 ------------------- src/Product/Importer.php | 28 +------ src/Resources/config/services.xml | 5 +- src/ValueHandler/AttributeValueHandler.php | 16 +--- .../ChannelPricingValueHandler.php | 31 ++------ .../ProductOptionValueHandler.php | 70 ++++------------- 9 files changed, 26 insertions(+), 262 deletions(-) diff --git a/spec/Converter/ValueConverterSpec.php b/spec/Converter/ValueConverterSpec.php index b840a295..0cd9dda5 100644 --- a/spec/Converter/ValueConverterSpec.php +++ b/spec/Converter/ValueConverterSpec.php @@ -49,7 +49,7 @@ public function let( ] ); - $this->beConstructedWith(); + $this->beConstructedWith($translator); } function it_is_initializable() @@ -91,24 +91,9 @@ function it_throws_exception_during_convert_when_value_contains_amount_key_and_n ]); } - function it_converts_metric_value_from_akeneo_to_text_value_not_translated_when_translator_is_not_injected( - AttributeInterface $textAttribute - ) { - $this->convert( - $textAttribute, - [ - 'amount' => 23.0000, - 'unit' => 'INCH', - ], - 'it' - )->shouldReturn('23 INCH'); - } - function it_converts_metric_value_from_akeneo_to_text_value_translated_when_translator_is_injected( - TranslatorInterface $translator, AttributeInterface $textAttribute ) { - $this->beConstructedWith($translator); $this->convert( $textAttribute, [ diff --git a/src/Controller/ProductEnqueueController.php b/src/Controller/ProductEnqueueController.php index c8e9608c..03e1f447 100644 --- a/src/Controller/ProductEnqueueController.php +++ b/src/Controller/ProductEnqueueController.php @@ -17,39 +17,16 @@ final class ProductEnqueueController extends AbstractController { - private ?TranslatorInterface $translator; - - /** - * ProductEnqueueController constructor. - */ public function __construct( private QueueItemRepositoryInterface $queueItemRepository, private ProductRepositoryInterface $productRepository, private UrlGeneratorInterface $urlGenerator, - TranslatorInterface $translator = null + private TranslatorInterface $translator ) { - if ($translator === null) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.12', - 'Not passing a translator to "%s" is deprecated and will be removed in %s.', - self::class, - '2.0' - ); - } - $this->translator = $translator; } public function enqueueAction(int $productId): Response { - if ($this->translator === null) { - /** - * @psalm-suppress DeprecatedMethod - */ - $translator = $this->get('translator'); - Assert::isInstanceOf($translator, TranslatorInterface::class); - $this->translator = $translator; - } /** @var ProductInterface|null $product */ $product = $this->productRepository->find($productId); if ($product === null) { diff --git a/src/Converter/ValueConverter.php b/src/Converter/ValueConverter.php index e59706a5..cac21ac7 100644 --- a/src/Converter/ValueConverter.php +++ b/src/Converter/ValueConverter.php @@ -11,24 +11,9 @@ final class ValueConverter implements ValueConverterInterface { - private ?TranslatorInterface $translator; - - /** - * ValueConverter constructor. - */ public function __construct( - TranslatorInterface $translator = null + private TranslatorInterface $translator ) { - if ($translator === null) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.8', - 'Not passing a translator to "%s" is deprecated and will be removed in %s.', - self::class, - '2.0' - ); - } - $this->translator = $translator; } public function convert(AttributeInterface $attribute, array|bool|int|string $value, string $localeCode): array|bool|int|string @@ -44,9 +29,6 @@ public function convert(AttributeInterface $attribute, array|bool|int|string $va throw new \LogicException('Unit key not found'); } $unit = (string) $value['unit']; - if ($this->translator === null) { - return $floatAmount . ' ' . $unit; - } return $this->translator->trans('webgriffe_sylius_akeneo.ui.metric_amount_unit', ['unit' => $unit, 'amount' => $floatAmount], null, $localeCode); } diff --git a/src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php b/src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php index a812d06e..3a95aca5 100644 --- a/src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php +++ b/src/DependencyInjection/WebgriffeSyliusAkeneoExtension.php @@ -30,79 +30,6 @@ final class WebgriffeSyliusAkeneoExtension extends AbstractResourceExtension imp private const RECONCILER_TAG = 'webgriffe_sylius_akeneo.reconciler'; - /** - * @var array - * - * @deprecated Do not use anymore. Use $valueHandlersTypesDefinitionsPrivate instead. - */ - public static $valueHandlersTypesDefinitions = [ - 'channel_pricing' => [ - 'class' => ChannelPricingValueHandler::class, - 'arguments' => [ - 'sylius.factory.channel_pricing', - 'sylius.repository.channel', - 'sylius.repository.currency', - ], - ], - 'generic_property' => [ - 'class' => GenericPropertyValueHandler::class, - 'arguments' => [ - 'property_accessor', - ], - ], - 'image' => [ - 'class' => ImageValueHandler::class, - 'arguments' => [ - 'sylius.factory.product_image', - 'sylius.repository.product_image', - 'webgriffe_sylius_akeneo.api_client', - ], - ], - 'immutable_slug' => [ - 'class' => ImmutableSlugValueHandler::class, - 'arguments' => [ - 'webgriffe_sylius_akeneo.slugify', - 'sylius.factory.product_translation', - 'sylius.translation_locale_provider.admin', - 'sylius.repository.product_translation', - ], - ], - 'product_option' => [ - 'class' => ProductOptionValueHandler::class, - 'arguments' => [ - 'webgriffe_sylius_akeneo.api_client', - 'sylius.repository.product_option', - 'sylius.factory.product_option_value', - 'sylius.factory.product_option_value_translation', - 'sylius.repository.product_option_value', - ], - ], - 'translatable_property' => [ - 'class' => TranslatablePropertyValueHandler::class, - 'arguments' => [ - 'property_accessor', - 'sylius.factory.product_translation', - 'sylius.factory.product_variant_translation', - 'sylius.translation_locale_provider.admin', - ], - ], - 'generic_attribute' => [ - 'class' => AttributeValueHandler::class, - 'arguments' => [ - 'sylius.repository.product_attribute', - 'sylius.factory.product_attribute_value', - 'sylius.translation_locale_provider.admin', - ], - ], - 'file_attribute' => [ - 'class' => FileAttributeValueHandler::class, - 'arguments' => [ - 'webgriffe_sylius_akeneo.api_client', - 'filesystem', - ], - ], - ]; - /** @var array */ private static array $valueHandlersTypesDefinitionsPrivate = [ 'channel_pricing' => [ @@ -194,9 +121,6 @@ public function load(array $config, ContainerBuilder $container): void Assert::isArray($config['resources']); $this->registerResources('webgriffe_sylius_akeneo', 'doctrine/orm', $config['resources'], $container); - // The following registers plugin resources again with a different prefix. This is only for BC compatibility - // and could be removed in 2.x. - $this->registerResources('webgriffe_sylius_akeneo_plugin', 'doctrine/orm', $config['resources'], $container); $this->registerApiClientParameters($config['api_client'], $container); $loader->load('services.xml'); diff --git a/src/Product/Importer.php b/src/Product/Importer.php index 1e56ab89..8307e4ff 100644 --- a/src/Product/Importer.php +++ b/src/Product/Importer.php @@ -29,8 +29,6 @@ final class Importer implements ImporterInterface, ReconcilerInterface { private const AKENEO_ENTITY = 'Product'; - private StatusResolverInterface $variantStatusResolver; - public function __construct( private ProductVariantFactoryInterface $productVariantFactory, private ProductVariantRepositoryInterface $productVariantRepository, @@ -44,24 +42,10 @@ public function __construct( private ChannelsResolverInterface $channelsResolver, private StatusResolverInterface $statusResolver, private FactoryInterface $productTaxonFactory, - StatusResolverInterface $variantStatusResolver = null + private StatusResolverInterface $variantStatusResolver ) { - if (null === $variantStatusResolver) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.2', - 'Not passing a variant status resolver to "%s" is deprecated and will be removed in %s.', - self::class, - '2.0' - ); - $variantStatusResolver = new VariantStatusResolver(); - } - $this->variantStatusResolver = $variantStatusResolver; } - /** - * @inheritdoc - */ public function getAkeneoEntity(): string { return self::AKENEO_ENTITY; @@ -112,10 +96,7 @@ public function import(string $identifier): void $this->dispatchPostEvent($product, $eventName); } - /** - * @inheritdoc - * @psalm-return array - */ + /** @psalm-return array */ public function getIdentifiersModifiedSince(DateTime $sinceDate): array { $searchBuilder = new SearchBuilder(); @@ -130,10 +111,7 @@ public function getIdentifiersModifiedSince(DateTime $sinceDate): array return $identifiers; } - /** - * @inheritdoc - * @psalm-return array - */ + /** @psalm-return array */ public function getAllIdentifiers(): array { return $this->getIdentifiersModifiedSince((new DateTime())->setTimestamp(0)); diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 486c56c7..89adc2c3 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -16,8 +16,6 @@ - - @@ -77,12 +75,11 @@ + - - diff --git a/src/ValueHandler/AttributeValueHandler.php b/src/ValueHandler/AttributeValueHandler.php index 87808a77..8c029208 100644 --- a/src/ValueHandler/AttributeValueHandler.php +++ b/src/ValueHandler/AttributeValueHandler.php @@ -18,32 +18,18 @@ use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Resource\Repository\RepositoryInterface; use Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface; -use Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverter; use Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface; use Webgriffe\SyliusAkeneoPlugin\ValueHandlerInterface; use Webmozart\Assert\Assert; final class AttributeValueHandler implements ValueHandlerInterface { - private ValueConverterInterface $valueConverter; - public function __construct( private RepositoryInterface $attributeRepository, private FactoryInterface $factory, private TranslationLocaleProviderInterface $localeProvider, - ValueConverterInterface $valueConverter = null + private ValueConverterInterface $valueConverter ) { - if ($valueConverter === null) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.8', - 'Not passing a value converter to "%s" is deprecated and will be removed in %s.', - self::class, - '2.0' - ); - $valueConverter = new ValueConverter(); - } - $this->valueConverter = $valueConverter; } /** diff --git a/src/ValueHandler/ChannelPricingValueHandler.php b/src/ValueHandler/ChannelPricingValueHandler.php index a858e89b..9838775f 100644 --- a/src/ValueHandler/ChannelPricingValueHandler.php +++ b/src/ValueHandler/ChannelPricingValueHandler.php @@ -4,6 +4,7 @@ namespace Webgriffe\SyliusAkeneoPlugin\ValueHandler; +use InvalidArgumentException; use Sylius\Component\Channel\Repository\ChannelRepositoryInterface; use Sylius\Component\Core\Model\ChannelInterface; use Sylius\Component\Core\Model\ChannelPricingInterface; @@ -17,43 +18,25 @@ final class ChannelPricingValueHandler implements ValueHandlerInterface { - private ?PropertyAccessorInterface $propertyAccessor; - public function __construct( private FactoryInterface $channelPricingFactory, private ChannelRepositoryInterface $channelRepository, private RepositoryInterface $currencyRepository, private string $akeneoAttribute, - PropertyAccessorInterface $propertyAccessor = null, + private PropertyAccessorInterface $propertyAccessor, private string $syliusPropertyPath = 'price' ) { - if ($propertyAccessor === null) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.12', - 'Not passing a property accessor to "%s" is deprecated and will be removed in %s.', - self::class, - '2.0' - ); - } - $this->propertyAccessor = $propertyAccessor; } - /** - * @inheritdoc - */ public function supports($subject, string $attribute, array $value): bool { return $subject instanceof ProductVariantInterface && $attribute === $this->akeneoAttribute; } - /** - * @inheritdoc - */ public function handle($subject, string $attribute, array $value): void { if (!$subject instanceof ProductVariantInterface) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( sprintf( 'This channel pricing value handler only supports instances of %s, %s given.', ProductVariantInterface::class, @@ -85,12 +68,8 @@ public function handle($subject, string $attribute, array $value): void $channelPricing->setChannelCode($channel->getCode()); } - if ($this->propertyAccessor === null) { - $channelPricing->setPrice((int) round($price * 100)); - } else { - $this->propertyAccessor->setValue($channelPricing, $this->syliusPropertyPath, (int) round($price * 100)); - Assert::isInstanceOf($channelPricing, ChannelPricingInterface::class); - } + $this->propertyAccessor->setValue($channelPricing, $this->syliusPropertyPath, (int) round($price * 100)); + Assert::isInstanceOf($channelPricing, ChannelPricingInterface::class); if ($isNewChannelPricing) { $subject->addChannelPricing($channelPricing); } diff --git a/src/ValueHandler/ProductOptionValueHandler.php b/src/ValueHandler/ProductOptionValueHandler.php index 91f558ee..f4c994fa 100644 --- a/src/ValueHandler/ProductOptionValueHandler.php +++ b/src/ValueHandler/ProductOptionValueHandler.php @@ -24,39 +24,15 @@ final class ProductOptionValueHandler implements ValueHandlerInterface { - private ?TranslationLocaleProviderInterface $translationLocaleProvider; - - private ?TranslatorInterface $translator; - public function __construct( private AkeneoPimClientInterface $apiClient, private ProductOptionRepositoryInterface $productOptionRepository, private FactoryInterface $productOptionValueFactory, private FactoryInterface $productOptionValueTranslationFactory, private RepositoryInterface $productOptionValueRepository, - TranslationLocaleProviderInterface $translationLocaleProvider = null, - TranslatorInterface $translator = null + private TranslationLocaleProviderInterface $translationLocaleProvider, + private TranslatorInterface $translator ) { - if ($translationLocaleProvider === null) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.6', - 'Not passing a translation locale provider to %s is deprecated and will not be possible anymore in %s', - self::class, - '2.0' - ); - } - $this->translationLocaleProvider = $translationLocaleProvider; - if ($translator === null) { - trigger_deprecation( - 'webgriffe/sylius-akeneo-plugin', - '1.15', - 'Not passing a translator to %s is deprecated and will not be possible anymore in %s', - __CLASS__, - '2.0' - ); - } - $this->translator = $translator; } /** @@ -130,12 +106,12 @@ public function handle($productVariant, string $optionCode, array $akeneoValue): break; case 'pim_catalog_metric': Assert::isArray($akeneoValueData); - $this->handleMetricOption($productOption, $optionCode, $akeneoValueData, $product, $productVariant); + $this->handleMetricOption($productOption, $optionCode, $akeneoValueData, $productVariant); break; case 'pim_catalog_boolean': Assert::boolean($akeneoValueData); - $this->handleBooleanOption($productOption, $optionCode, $akeneoValueData, $product, $productVariant); + $this->handleBooleanOption($productOption, $optionCode, $akeneoValueData, $productVariant); break; default: @@ -169,8 +145,7 @@ private function handleSelectOption(ProductOptionInterface $productOption, strin throw $e; } foreach ($akeneoAttributeOption['labels'] as $localeCode => $label) { - if ($this->translationLocaleProvider !== null && - !in_array($localeCode, $this->translationLocaleProvider->getDefinedLocalesCodes(), true)) { + if (!in_array($localeCode, $this->translationLocaleProvider->getDefinedLocalesCodes(), true)) { continue; } $optionValueTranslation = $optionValue->getTranslation($localeCode); @@ -189,7 +164,7 @@ private function handleSelectOption(ProductOptionInterface $productOption, strin } } - private function handleMetricOption(ProductOptionInterface $productOption, string $optionCode, array $akeneoDataValue, ProductInterface $product, ProductVariantInterface $productVariant): void + private function handleMetricOption(ProductOptionInterface $productOption, string $optionCode, array $akeneoDataValue, ProductVariantInterface $productVariant): void { if (!array_key_exists('amount', $akeneoDataValue)) { throw new LogicException('Amount key not found'); @@ -204,13 +179,10 @@ private function handleMetricOption(ProductOptionInterface $productOption, strin $optionValue = $this->getOrCreateProductOptionValue($optionValueCode, $productOption); /** @var string[] $locales */ - $locales = $this->getLocaleCodes($product); + $locales = $this->getLocaleCodes(); foreach ($locales as $localeCode) { - $label = $floatAmount . ' ' . $unit; - if ($this->translator !== null) { - $label = $this->translator->trans('webgriffe_sylius_akeneo.ui.metric_amount_unit', ['unit' => $unit, 'amount' => $floatAmount], null, $localeCode); - } + $label = $this->translator->trans('webgriffe_sylius_akeneo.ui.metric_amount_unit', ['unit' => $unit, 'amount' => $floatAmount], null, $localeCode); $optionValue = $this->addOptionValueTranslation($optionValue, $localeCode, $label); } if (!$productVariant->hasOptionValue($optionValue)) { @@ -218,19 +190,16 @@ private function handleMetricOption(ProductOptionInterface $productOption, strin } } - private function handleBooleanOption(ProductOptionInterface $productOption, string $optionCode, bool $akeneoDataValue, ProductInterface $product, ProductVariantInterface $productVariant): void + private function handleBooleanOption(ProductOptionInterface $productOption, string $optionCode, bool $akeneoDataValue, ProductVariantInterface $productVariant): void { $optionValueCode = $this->createOptionValueCode($optionCode, (string) $akeneoDataValue); $optionValue = $this->getOrCreateProductOptionValue($optionValueCode, $productOption); /** @var string[] $locales */ - $locales = $this->getLocaleCodes($product); + $locales = $this->getLocaleCodes(); foreach ($locales as $localeCode) { - $label = (string) $akeneoDataValue; - if ($this->translator !== null) { - $label = $akeneoDataValue ? $this->translator->trans('sylius.ui.yes_label', [], null, $localeCode) : $this->translator->trans('sylius.ui.no_label', [], null, $localeCode); - } + $label = $akeneoDataValue ? $this->translator->trans('sylius.ui.yes_label', [], null, $localeCode) : $this->translator->trans('sylius.ui.no_label', [], null, $localeCode); $optionValue = $this->addOptionValueTranslation($optionValue, $localeCode, $label); } if (!$productVariant->hasOptionValue($optionValue)) { @@ -277,22 +246,9 @@ private function getOrCreateProductOptionValue(string $optionValueCode, ProductO return $optionValue; } - private function getLocaleCodes(ProductInterface $product): array + private function getLocaleCodes(): array { - $locales = []; - if ($this->translationLocaleProvider !== null) { - $locales = $this->translationLocaleProvider->getDefinedLocalesCodes(); - } else { - foreach ($product->getTranslations() as $translation) { - $locale = $translation->getLocale(); - if ($locale === null) { - continue; - } - $locales[] = $locale; - } - } - - return $locales; + return $this->translationLocaleProvider->getDefinedLocalesCodes(); } private function addOptionValueTranslation( From a2a44c57cbf73a36130201d296863762e89cce0f Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 11 Apr 2022 12:03:06 +0200 Subject: [PATCH 2/4] Rename CHANGELOG-2.0.md in UPGRADE-2.0.md (#44) --- CHANGELOG-2.0.md | 30 ---------------- UPGRADE-2.0.md | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 30 deletions(-) delete mode 100644 CHANGELOG-2.0.md create mode 100644 UPGRADE-2.0.md diff --git a/CHANGELOG-2.0.md b/CHANGELOG-2.0.md deleted file mode 100644 index 89fed786..00000000 --- a/CHANGELOG-2.0.md +++ /dev/null @@ -1,30 +0,0 @@ -# UPGRADE FROM `v1.13.3` TO `v2.0.0` - -## Codebase - -### Use PHP 8 syntax (#128) - -#### Changed -- [BC] The return type of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface#convert() changed from no type to array|bool|int|string -- [BC] The parameter $value of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface#convert() changed from no type to a non-contravariant array|bool|int|string -- [BC] The parameter $value of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface#convert() changed from no type to array|bool|int|string -- [BC] The parameter $value of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverter#convert() changed from no type to a non-contravariant array|bool|int|string - -### API client replacement (#125) - -#### Changed -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\AttributeOptions\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\AttributeOptions\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\Converter\UnitMeasurementValueConverter#__construct() changed from Webgriffe\SyliusAkeneoPlugin\MeasurementFamiliesApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\Product\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\Product\ProductOptionsResolver#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ValueHandler\FileAttributeValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ImageValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface -- [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ProductAssociations\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface - -#### Removed -- [BC] Class Webgriffe\SyliusAkeneoPlugin\AttributeOptions\ApiClientInterface has been deleted -- [BC] Class Webgriffe\SyliusAkeneoPlugin\ApiClientInterface has been deleted -- [BC] Class Webgriffe\SyliusAkeneoPlugin\MeasurementFamiliesApiClientInterface has been deleted -- [BC] Class Webgriffe\SyliusAkeneoPlugin\ApiClient has been deleted -- [BC] Class Webgriffe\SyliusAkeneoPlugin\FamilyAwareApiClientInterface has been deleted diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md new file mode 100644 index 00000000..e5d23f5d --- /dev/null +++ b/UPGRADE-2.0.md @@ -0,0 +1,89 @@ +# UPGRADE FROM `v1.14.0` TO `v2.0.0` + +## Codebase + +### Use PHP 8 syntax (#128) + +#### TL;DR +Refactored the codebase to use PHP 8 syntax. + +#### BC Breaks + +##### Changed + - [BC] The return type of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface#convert() changed from no type to array|bool|int|string + - [BC] The parameter $value of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface#convert() changed from no type to a non-contravariant array|bool|int|string + - [BC] The parameter $value of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface#convert() changed from no type to array|bool|int|string + - [BC] The parameter $value of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverter#convert() changed from no type to a non-contravariant array|bool|int|string + +### API client replacement (#125) + +#### TL;DR +Removed our API Client interface in favor of the Akeneo PHP SDK client. + +#### BC Breaks + +##### Changed + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\AttributeOptions\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\AttributeOptions\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\Converter\UnitMeasurementValueConverter#__construct() changed from Webgriffe\SyliusAkeneoPlugin\MeasurementFamiliesApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\Product\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\Product\ProductOptionsResolver#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ValueHandler\FileAttributeValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ImageValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + - [BC] The parameter $apiClient of Webgriffe\SyliusAkeneoPlugin\ProductAssociations\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\ApiClientInterface to a non-contravariant Akeneo\Pim\ApiClient\AkeneoPimClientInterface + +##### Removed + - [BC] Class Webgriffe\SyliusAkeneoPlugin\AttributeOptions\ApiClientInterface has been deleted + - [BC] Class Webgriffe\SyliusAkeneoPlugin\ApiClientInterface has been deleted + - [BC] Class Webgriffe\SyliusAkeneoPlugin\MeasurementFamiliesApiClientInterface has been deleted + - [BC] Class Webgriffe\SyliusAkeneoPlugin\ApiClient has been deleted + - [BC] Class Webgriffe\SyliusAkeneoPlugin\FamilyAwareApiClientInterface has been deleted + +### Remove deprecations (#130) + +#### TL;DR +Removed all deprecations of the v1.x releases. + +#### BC Breaks + +##### Changed + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\Controller\ProductEnqueueController#__construct() increased from 3 to 4 + - [BC] The parameter $translator of Webgriffe\SyliusAkeneoPlugin\Controller\ProductEnqueueController#__construct() changed from Symfony\Contracts\Translation\TranslatorInterface|null to a non-contravariant Symfony\Contracts\Translation\TranslatorInterface + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverter#__construct() increased from 0 to 1 + - [BC] The parameter $translator of Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverter#__construct() changed from Symfony\Contracts\Translation\TranslatorInterface|null to a non-contravariant Symfony\Contracts\Translation\TranslatorInterface + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\Product\Importer#__construct() increased from 12 to 13 + - [BC] The parameter $variantStatusResolver of Webgriffe\SyliusAkeneoPlugin\Product\Importer#__construct() changed from Webgriffe\SyliusAkeneoPlugin\Product\StatusResolverInterface|null to a non-contravariant Webgriffe\SyliusAkeneoPlugin\Product\StatusResolverInterface + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\ValueHandler\AttributeValueHandler#__construct() increased from 3 to 4 + - [BC] The parameter $valueConverter of Webgriffe\SyliusAkeneoPlugin\ValueHandler\AttributeValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface|null to a non-contravariant Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\ValueHandler\ChannelPricingValueHandler#__construct() increased from 4 to 5 + - [BC] The parameter $propertyAccessor of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ChannelPricingValueHandler#__construct() changed from Symfony\Component\PropertyAccess\PropertyAccessorInterface|null to a non-contravariant Symfony\Component\PropertyAccess\PropertyAccessorInterface + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() increased from 5 to 6 + - [BC] The parameter $translationLocaleProvider of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() changed from Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface|null to a non-contravariant Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface + +##### Removed + - [BC] Property Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::$valueHandlersTypesDefinitions was removed + - [BC] Removed the service `webgriffe_sylius_akeneo_plugin.repository.cleanable_queue_item`, use the `webgriffe_sylius_akeneo.repository.cleanable_queue_item` instead. + - [BC] Removed the service `webgriffe_sylius_akeneo_plugin.controller.product_enqueue_controller`, use the `webgriffe_sylius_akeneo.controller.product_enqueue_controller` instead. + - [BC] Removed the resource `webgriffe_sylius_akeneo_plugin.queue_item` use the `webgriffe_sylius_akeneo.queue_item` instead. + +### Test changes + +#### TL;DR +Edits made on test classes during the previous changes. + +#### BC Breaks + +##### Removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findProductModel() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findFamilyVariant() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findAttribute() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findProduct() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findAttributeOption() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#downloadFile() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findProductsModifiedSince() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findAllAttributeOptions() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findAllAttributes() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findAllFamilies() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#findFamily() was removed + - [BC] Method Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock#getMeasurementFamilies() was removed + - [BC] These ancestors of Tests\Webgriffe\SyliusAkeneoPlugin\Integration\TestDouble\ApiClientMock have been removed: ["Webgriffe\\SyliusAkeneoPlugin\\ApiClientInterface","Webgriffe\\SyliusAkeneoPlugin\\AttributeOptions\\ApiClientInterface","Webgriffe\\SyliusAkeneoPlugin\\FamilyAwareApiClientInterface","Webgriffe\\SyliusAkeneoPlugin\\MeasurementFamiliesApiClientInterface"] From 3c36d635b82e9e2b6a319772f9c661a6e847cc17 Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 11 Apr 2022 12:10:21 +0200 Subject: [PATCH 3/4] Add CHANGELOG-2.0.md (#44) --- CHANGELOG-2.0.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CHANGELOG-2.0.md diff --git a/CHANGELOG-2.0.md b/CHANGELOG-2.0.md new file mode 100644 index 00000000..91143eea --- /dev/null +++ b/CHANGELOG-2.0.md @@ -0,0 +1,16 @@ +# CHANGELOG FOR `2.0.X` + +## v2.0.0 + +#### TL;DR + +Drop support for PHP 7.4, Sylius < 1.11 and Symfony < 5.4. +Use PHP 8 syntax. Replacement of our ApiClient with the [Akeneo API PHP client](https://github.com/akeneo/api-php-client). +Removed all deprecations of the v1.x releases. + +#### Details + +* Upgrade to Sylius 1.11 by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/124 +* Use PHP 8 syntax (#126) by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/128 +* API client replacement by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/125 +* Remove deprecations (#44) by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/130 From 60ef33bf99fff2381fc7a01e95641e49a38d77f1 Mon Sep 17 00:00:00 2001 From: Lorenzo Ruozzi Date: Mon, 6 Jun 2022 11:32:34 +0200 Subject: [PATCH 4/4] Update UPGRADE-2.0.md and remove CHANGELOG-2.0.md (#44) --- CHANGELOG-2.0.md | 16 ---------------- UPGRADE-2.0.md | 3 ++- 2 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 CHANGELOG-2.0.md diff --git a/CHANGELOG-2.0.md b/CHANGELOG-2.0.md deleted file mode 100644 index 91143eea..00000000 --- a/CHANGELOG-2.0.md +++ /dev/null @@ -1,16 +0,0 @@ -# CHANGELOG FOR `2.0.X` - -## v2.0.0 - -#### TL;DR - -Drop support for PHP 7.4, Sylius < 1.11 and Symfony < 5.4. -Use PHP 8 syntax. Replacement of our ApiClient with the [Akeneo API PHP client](https://github.com/akeneo/api-php-client). -Removed all deprecations of the v1.x releases. - -#### Details - -* Upgrade to Sylius 1.11 by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/124 -* Use PHP 8 syntax (#126) by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/128 -* API client replacement by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/125 -* Remove deprecations (#44) by @lruozzi9 in https://github.com/webgriffe/SyliusAkeneoPlugin/pull/130 diff --git a/UPGRADE-2.0.md b/UPGRADE-2.0.md index e5d23f5d..8461cdd6 100644 --- a/UPGRADE-2.0.md +++ b/UPGRADE-2.0.md @@ -57,8 +57,9 @@ Removed all deprecations of the v1.x releases. - [BC] The parameter $valueConverter of Webgriffe\SyliusAkeneoPlugin\ValueHandler\AttributeValueHandler#__construct() changed from Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface|null to a non-contravariant Webgriffe\SyliusAkeneoPlugin\Converter\ValueConverterInterface - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\ValueHandler\ChannelPricingValueHandler#__construct() increased from 4 to 5 - [BC] The parameter $propertyAccessor of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ChannelPricingValueHandler#__construct() changed from Symfony\Component\PropertyAccess\PropertyAccessorInterface|null to a non-contravariant Symfony\Component\PropertyAccess\PropertyAccessorInterface - - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() increased from 5 to 6 + - [BC] The number of required arguments for Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() increased from 5 to 7 - [BC] The parameter $translationLocaleProvider of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() changed from Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface|null to a non-contravariant Sylius\Component\Resource\Translation\Provider\TranslationLocaleProviderInterface + - [BC] The parameter $translator of Webgriffe\SyliusAkeneoPlugin\ValueHandler\ProductOptionValueHandler#__construct() changed from Symfony\Contracts\Translation\TranslatorInterface|null to a non-contravariant Symfony\Contracts\Translation\TranslatorInterface ##### Removed - [BC] Property Webgriffe\SyliusAkeneoPlugin\DependencyInjection\WebgriffeSyliusAkeneoExtension::$valueHandlersTypesDefinitions was removed