Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: oroinc/OroAkeneoBundle
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.2.5
Choose a base ref
...
head repository: oroinc/OroAkeneoBundle
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4.2
Choose a head ref

Commits on Jul 13, 2021

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    a09d2d7 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    f89675a View commit details

Commits on Jul 22, 2021

  1. Update docs

    dxops committed Jul 22, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    16ab731 View commit details
  2. Update docs

    dxops committed Jul 22, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    4e9f556 View commit details

Commits on Jul 26, 2021

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    efa145a View commit details

Commits on Aug 10, 2021

  1. Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    1eeea28 View commit details

Commits on Aug 16, 2021

  1. Report SSL connection errors

    dxops committed Aug 16, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    28e392f View commit details

Commits on Aug 31, 2021

  1. AKM-29: Memory leak in api step

    - flush removed from the core causes \Oro\Bundle\MessageQueueBundle\Client\BufferedMessageProducer::flushBuffer skip
    - causes \Oro\Bundle\AkeneoBundle\ImportExport\Writer\AsyncWriter to keep messages and json data in memory
    - \Akeneo\Pim\ApiClient\Pagination\Page::getPage do not free up memory because of json data in use
    dxops committed Aug 31, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    0e70f40 View commit details

Commits on Dec 7, 2021

  1. Update FileApplicationsDataProvider.php (#61)

    Avoid type error in some weard cases.
    mrfroasty authored Dec 7, 2021

    Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5964397 View commit details
  2. The identifier id is missing for a query of Oro\Bundle\IntegrationBun…

    …dle\Entity\Channel”
    dxops committed Dec 7, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    4127850 View commit details
  3. Update FileApplicationsDataProvider.php (#61)

    Avoid type error in some weard cases.
    dxops committed Dec 7, 2021

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    d75a48e View commit details

Commits on Mar 6, 2022

  1. Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c0b0ac6 View commit details

Commits on Mar 9, 2022

  1. Allow 5.0 builds

    dxops committed Mar 9, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    dxops Serhii Zhuravel
    Copy the full SHA
    3ae32ca View commit details

Commits on Apr 13, 2022

  1. AKM-34: Product filter breaks configurable products (#66)

    AKM-31: Split products and product models filters
    - do not allow duplicate jobs
    dxops authored Apr 13, 2022

    Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    8ea46c1 View commit details

Commits on May 26, 2022

  1. Add cleanup to cron

    dxops committed May 26, 2022
    Copy the full SHA
    d55190d View commit details

Commits on Jun 3, 2022

  1. Copy the full SHA
    0b720f4 View commit details

Commits on Aug 18, 2022

  1. Clear EM when field changes exists

    - fix oom during 2nd api step run
    dxops committed Aug 18, 2022
    Copy the full SHA
    b0a3266 View commit details

Commits on Aug 23, 2022

  1. Fix attributes usage for models (#76)

    Fix attributes usage for models
    Keep status from Akeneo for simple products
    Fix mapped sku usage
    dxops committed Aug 23, 2022
    Copy the full SHA
    543a98e View commit details

Commits on Nov 1, 2022

  1. AKM-36: Unexpected fs operations for invalid products (#78)

    * AKM-36: Unexpected fs operations for invalid products
    dxops committed Nov 1, 2022
    Copy the full SHA
    0d66f76 View commit details

Commits on Nov 9, 2022

  1. Copy the full SHA
    9b7c1ca View commit details

Commits on Dec 30, 2022

  1. Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1a92b6d View commit details

Commits on Feb 13, 2023

  1. Copy the full SHA
    1410cef View commit details
  2. Fixed PrimaryUnitPrecision set logic (#75)

    * Fixed `PrimaryUnitPrecision` set logic
    cystbear authored Feb 13, 2023

    Verified

    This commit was created on github.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    95c1817 View commit details
  3. Copy the full SHA
    eba174e View commit details
  4. Copy the full SHA
    863098e View commit details

Commits on Feb 14, 2023

  1. Copy the full SHA
    b9e144f View commit details
Showing with 1,520 additions and 619 deletions.
  1. +20 −0 .github/workflows/php.yml
  2. +14 −9 .php_cs.php
  3. +0 −13 .travis.yml
  4. +23 −1 Async/ImportProductProcessor.php
  5. +4 −1 Async/SyncIntegrationProcessor.php
  6. +106 −0 Command/CleanupCommand.php
  7. +28 −0 Config/ConfigManager.php
  8. +4 −2 Controller/ValidateConnectionController.php
  9. +1 −0 DependencyInjection/OroAkeneoExtension.php
  10. +0 −6 Entity/AkeneoLocale.php
  11. +27 −9 Entity/AkeneoSettings.php
  12. +5 −0 EventListener/AdditionalOptionalListenerTrait.php
  13. +2 −0 Form/Extension/ChannelTypeExtension.php
  14. +9 −0 Form/Type/AkeneoSettingsType.php
  15. +33 −1 ImportExport/DataConverter/AttributeDataConverter.php
  16. +2 −28 ImportExport/DataConverter/ProductDataConverter.php
  17. +11 −1 ImportExport/EventListener/OwnerStrategyEventListener.php
  18. +0 −57 ImportExport/Processor/AsyncProcessor.php
  19. +4 −2 ImportExport/Processor/AttributeImportProcessor.php
  20. +106 −25 ImportExport/Processor/ProductVariantProcessor.php
  21. +15 −5 ImportExport/Reader/ProductImageReader.php
  22. +4 −4 ImportExport/Reader/ProductPriceReader.php
  23. +10 −4 ImportExport/Reader/ProductReader.php
  24. +4 −4 ImportExport/Reader/ProductVariantReader.php
  25. +21 −0 ImportExport/Strategy/AttributeImportStrategy.php
  26. +0 −35 ImportExport/Strategy/ImportLogStrategyHelper.php
  27. +0 −148 ImportExport/Strategy/ImportStrategyHelper.php
  28. +52 −14 ImportExport/Strategy/ProductImageImportStrategy.php
  29. +89 −12 ImportExport/Strategy/ProductImportStrategy.php
  30. +1 −0 ImportExport/Strategy/ProductPriceImportStrategy.php
  31. +0 −1 ImportExport/Strategy/StrategyRelationsTrait.php
  32. +35 −4 ImportExport/Strategy/StrategyValidationTrait.php
  33. +145 −119 ImportExport/Writer/AsyncWriter.php
  34. +3 −2 ImportExport/Writer/AttributeWriter.php
  35. +274 −0 ImportExport/Writer/ConfigurableAsyncWriter.php
  36. +4 −1 ImportExport/Writer/CumulativeWriter.php
  37. +15 −2 Integration/AkeneoFileManager.php
  38. +4 −8 Integration/AkeneoSearchBuilder.php
  39. +88 −17 Integration/AkeneoTransport.php
  40. +6 −0 Integration/AkeneoTransportInterface.php
  41. +74 −0 Integration/Connector/ConfigurableProductConnector.php
  42. +4 −14 Integration/Connector/ProductConnector.php
  43. +44 −0 Integration/Iterator/ConfigurableProductIterator.php
  44. +70 −11 Integration/Iterator/ProductIterator.php
  45. +2 −2 Job/Context/SimpleContextAggregator.php
  46. +2 −2 Layout/DataProvider/FileApplicationsDataProvider.php
  47. +2 −1 Migrations/Schema/OroAkeneoBundleInstaller.php
  48. +19 −0 Migrations/Schema/v1_16/OroAkeneoMigration.php
  49. +27 −8 README.md
  50. +15 −1 Resources/config/batch_jobs.yml
  51. +9 −0 Resources/config/commands.yml
  52. +38 −22 Resources/config/importexport.yml
  53. +2 −11 Resources/config/services.yml
  54. +5 −0 Resources/translations/messages.en.yml
  55. +2 −0 Resources/translations/validators.en.yml
  56. +11 −0 Resources/views/Form/fields.html.twig
  57. +1 −0 Tools/AttributeTypeConverter.php
  58. +16 −0 Tools/CacheProviderTrait.php
  59. +1 −2 Validator/JsonValidator.php
  60. +7 −10 Validator/UniqueProductVariantLinksValidator.php
20 changes: 20 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: PHP Composer

on:
push:
branches: [ master 5.0 4.2 4.1 3.1 1.6 ]
pull_request:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: php -r "copy('https://cs.symfony.com/download/php-cs-fixer-v3.phar', 'php-cs-fixer.phar');"

- name: Run php-cs-fixer
run: php php-cs-fixer.phar fix --dry-run --config=.php_cs.php --cache-file=.php_cs.cache --verbose --show-progress=dots --diff --allow-risky=yes
23 changes: 14 additions & 9 deletions .php_cs.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<?php

$finder = PhpCsFixer\Finder::create()
$finder = \PhpCsFixer\Finder::create()
->in(__DIR__);

return PhpCsFixer\Config::create()
return (new \PhpCsFixer\Config())
->setFinder($finder)
->setRules(
[
// generic PSRs
'@PSR1' => true,
'@PSR2' => true,
'psr0' => true,
'psr4' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'psr_autoloading' => true,

// imports
'ordered_imports' => true,
@@ -39,11 +40,14 @@
'escape_implicit_backslashes' => false,

// PHP
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHP74Migration' => true,
'@PHP74Migration:risky' => true,
'@PHP80Migration' => true,
'@PHP80Migration:risky' => true,

'use_arrow_functions' => false,
'get_class_to_class_keyword' => false,
'void_return' => false,
'visibility_required' => false,
'list_syntax' => ['syntax' => 'long'],
'declare_strict_types' => false,

@@ -64,11 +68,11 @@
'@Symfony:risky' => true,
'phpdoc_types_order' => false,
'phpdoc_separation' => false,
'phpdoc_inline_tag' => false,
'visibility_required' => ['elements' => ['property', 'method']],
'types_spaces' => false,
'native_function_invocation' => false,
'concat_space' => ['spacing' => 'one'],
'single_space_after_construct' => false,
'trailing_comma_in_multiline_array' => false,
'self_accessor' => false,
'yoda_style' => false,
'phpdoc_summary' => false,
@@ -87,6 +91,7 @@
'ternary_operator_spaces' => false,
'phpdoc_no_useless_inheritdoc' => false,
'class_definition' => false,
'string_length_to_empty' => false,
]
)
->setRiskyAllowed(true);
13 changes: 0 additions & 13 deletions .travis.yml

This file was deleted.

24 changes: 23 additions & 1 deletion Async/ImportProductProcessor.php
Original file line number Diff line number Diff line change
@@ -3,13 +3,15 @@
namespace Oro\Bundle\AkeneoBundle\Async;

use Doctrine\ORM\EntityManagerInterface;
use Oro\Bundle\AkeneoBundle\Tools\CacheProviderTrait;
use Oro\Bundle\EntityBundle\ORM\DoctrineHelper;
use Oro\Bundle\IntegrationBundle\Authentication\Token\IntegrationTokenAwareTrait;
use Oro\Bundle\IntegrationBundle\Entity\Channel as Integration;
use Oro\Bundle\IntegrationBundle\Entity\FieldsChanges;
use Oro\Bundle\IntegrationBundle\Provider\SyncProcessorRegistry;
use Oro\Bundle\MessageQueueBundle\Entity\Job;
use Oro\Component\MessageQueue\Client\TopicSubscriberInterface;
use Oro\Component\MessageQueue\Consumption\MessageProcessorInterface;
use Oro\Component\MessageQueue\Job\Job;
use Oro\Component\MessageQueue\Job\JobRunner;
use Oro\Component\MessageQueue\Transport\MessageInterface;
use Oro\Component\MessageQueue\Transport\SessionInterface;
@@ -19,6 +21,7 @@

class ImportProductProcessor implements MessageProcessorInterface, TopicSubscriberInterface
{
use CacheProviderTrait;
use IntegrationTokenAwareTrait;

/** @var DoctrineHelper */
@@ -97,12 +100,31 @@ public function process(MessageInterface $message, SessionInterface $session)
function (JobRunner $jobRunner, Job $child) use ($integration, $body) {
$this->doctrineHelper->refreshIncludingUnitializedRelations($integration);
$processor = $this->syncProcessorRegistry->getProcessorForIntegration($integration);

$em = $this->doctrineHelper->getEntityManager(FieldsChanges::class);
/** @var FieldsChanges $fieldsChanges */
$fieldsChanges = $em
->getRepository(FieldsChanges::class)
->findOneBy(['entityId' => $child->getId(), 'entityClass' => Job::class]);

if (!$fieldsChanges) {
$this->logger->error(
sprintf('Source data from Akeneo not found for job: %s', $child->getId())
);

return false;
}

$this->cacheProvider->save('akeneo', $fieldsChanges->getChangedFields());

$status = $processor->process(
$integration,
$body['connector'] ?? null,
$body['connector_parameters'] ?? []
);

$em->clear(FieldsChanges::class);

return $status;
}
);
5 changes: 4 additions & 1 deletion Async/SyncIntegrationProcessor.php
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ManagerRegistry;
use Oro\Bundle\AkeneoBundle\Integration\AkeneoChannel;
use Oro\Bundle\IntegrationBundle\Async\Topics;
use Oro\Bundle\IntegrationBundle\Authentication\Token\IntegrationTokenAwareTrait;
use Oro\Bundle\IntegrationBundle\Entity\Channel as Integration;
@@ -117,7 +118,9 @@ function (JobRunner $jobRunner, Job $job) use ($integration, $body) {
$processor->getLoggerStrategy()->setLogger($this->logger);
}
$connectorParameters = $body['connector_parameters'];
$connectorParameters['rootJobId'] = $job->getRootJob()->getId();
if ($integration->getType() === AkeneoChannel::TYPE) {
$connectorParameters['rootJobId'] = $job->getRootJob()->getId();
}

return $processor->process(
$integration,
106 changes: 106 additions & 0 deletions Command/CleanupCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

namespace Oro\Bundle\AkeneoBundle\Command;

use Oro\Bundle\BatchBundle\ORM\Query\BufferedIdentityQueryResultIterator;
use Oro\Bundle\CronBundle\Command\CronCommandInterface;
use Oro\Bundle\EntityBundle\ORM\DoctrineHelper;
use Oro\Bundle\IntegrationBundle\Entity\FieldsChanges;
use Oro\Bundle\MessageQueueBundle\Entity\Job;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Clears old records from oro_integration_fields_changes table before repack.
*/
class CleanupCommand extends Command implements CronCommandInterface
{
/** @var string */
protected static $defaultName = 'oro:cron:akeneo:cleanup';

/** @var DoctrineHelper */
private $doctrineHelper;

public function __construct(DoctrineHelper $doctrineHelper)
{
$this->doctrineHelper = $doctrineHelper;
parent::__construct();
}

public function isActive()
{
return true;
}

public function getDefaultDefinition()
{
return '0 2 * * 6';
}

public function configure()
{
$this
->setDescription('Clears old records from oro_integration_fields_changes table.')
->setHelp(
<<<'HELP'
The <info>%command.name%</info> command clears fields changes for complete job records
from <comment>oro_integration_fields_changes</comment> table.
<info>php %command.full_name%</info>
HELP
);
}

protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln(sprintf(
'<comment>Number of fields changes that has been deleted:</comment> %d',
$this->deleteRecords()
));

$output->writeln('<info>Fields changes cleanup complete</info>');

return 0;
}

private function deleteRecords(): int
{
$qb = $this->doctrineHelper
->getEntityManagerForClass(FieldsChanges::class)
->getRepository(FieldsChanges::class)
->createQueryBuilder('fc');

$qb
->delete(FieldsChanges::class, 'fc')
->where($qb->expr()->eq('fc.entityClass', ':class'))
->setParameter('class', Job::class)
->andWhere($qb->expr()->in('fc.entityId', ':ids'));

$jqb = $this->doctrineHelper
->getEntityManagerForClass(Job::class)
->getRepository(Job::class)
->createQueryBuilder('j');

$jqb
->select('j.id')
->where($jqb->expr()->in('j.status', ':statuses'))
->setParameter('statuses', [Job::STATUS_SUCCESS, Job::STATUS_CANCELLED, Job::STATUS_FAILED, Job::STATUS_STALE])
->orderBy($jqb->expr()->desc('j.id'));

$iterator = new BufferedIdentityQueryResultIterator($jqb->getQuery());

$result = 0;
$iterator->setPageLoadedCallback(function (array $rows) use ($qb, &$result): array {
$ids = array_column($rows, 'id');

$result = $result + $qb->setParameter('ids', $ids)->getQuery()->execute();

return $ids;
});

iterator_to_array($iterator);

return $result;
}
}
28 changes: 28 additions & 0 deletions Config/ConfigManager.php
Original file line number Diff line number Diff line change
@@ -32,4 +32,32 @@ public function hasChanges(): bool

return false;
}

protected function getDiff($values, $originalValues)
{
$diff = [];
if (empty($originalValues)) {
foreach ($values as $code => $value) {
$diff[$code] = [null, $value];
}
} else {
foreach ($originalValues as $code => $originalValue) {
if (array_key_exists($code, $values)) {
$value = $values[$code];
if ($originalValue != $value) {
$diff[$code] = [$originalValue, $value];
}
} else {
$diff[$code] = [$originalValue, null];
}
}
foreach ($values as $code => $value) {
if (!array_key_exists($code, $originalValues)) {
$diff[$code] = [null, $value];
}
}
}

return $diff;
}
}
6 changes: 4 additions & 2 deletions Controller/ValidateConnectionController.php
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
use Oro\Bundle\IntegrationBundle\Entity\Channel;
use Oro\Bundle\IntegrationBundle\Form\Type\ChannelType;
use Oro\Bundle\SecurityBundle\Annotation\Acl;
use Psr\Http\Client\ClientExceptionInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
@@ -52,6 +53,7 @@ public function validateConnectionAction(Request $request, Channel $channel = nu
$akeneoSettings->setPassword($akeneoSettingsEntity->getPassword());
}

/** @var \Oro\Bundle\CurrencyBundle\Provider\CurrencyListProviderInterface */
$currencyConfig = $this->container->get('oro_currency.config.currency');

$akeneoChannelNames = [];
@@ -78,7 +80,7 @@ public function validateConnectionAction(Request $request, Channel $channel = nu
$akeneoCurrencies = $transport->getMergedCurrencies();
$akeneoLocales = $transport->getLocales();
}
} catch (ExceptionInterface $e) {
} catch (ClientExceptionInterface | ExceptionInterface $e) {
$success = false;
$message = $e->getMessage();
} catch (\Exception $e) {
@@ -93,7 +95,7 @@ public function validateConnectionAction(Request $request, Channel $channel = nu
'akeneoLocales' => $akeneoLocales,
'success' => $success,
'message' => $this->get('translator')->trans($message),
'currencyList' => $currencyConfig->getCurrencies(),
'currencyList' => $currencyConfig->getCurrencyList(),
]
);
}
1 change: 1 addition & 0 deletions DependencyInjection/OroAkeneoExtension.php
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@ class OroAkeneoExtension extends Extension
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('commands.yml');
$loader->load('integration.yml');
$loader->load('importexport.yml');
$loader->load('services.yml');
6 changes: 0 additions & 6 deletions Entity/AkeneoLocale.php
Original file line number Diff line number Diff line change
@@ -53,9 +53,6 @@ public function getCode()
return $this->code;
}

/**
* @return AkeneoLocale
*/
public function setCode(string $code): self
{
$this->code = $code;
@@ -93,9 +90,6 @@ public function getAkeneoSettings()
return $this->akeneoSettings;
}

/**
* @return AkeneoLocale
*/
public function setAkeneoSettings(AkeneoSettings $akeneoSettings = null): self
{
$this->akeneoSettings = $akeneoSettings;
Loading