Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag to integration sync settings to log warnings during sync a… #1063

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,17 @@ protected function processExport(Integration $integration, ConnectorInterface $c
if ($errors) {
$warningsText = 'Some entities were skipped due to warnings:' . PHP_EOL;
$warningsText .= implode(PHP_EOL, $errors);

$message .= PHP_EOL . $warningsText;

if ($integration->getSynchronizationSettings()->offsetGetOr('logWarnings', false)) {
foreach ($errors as $error) {
$this->logger->error($error);
}
}
}
$status->setCode(Status::STATUS_COMPLETED)->setMessage($message);
} else {
$this->logger->error('Errors were occurred:');
$this->logger->error('Errors have occurred:');
$exceptions = implode(PHP_EOL, $exceptions);

$this->logger->error($exceptions);
Expand Down
9 changes: 7 additions & 2 deletions src/Oro/Bundle/IntegrationBundle/Provider/SyncProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,18 @@ protected function processImport(Integration $integration, ConnectorInterface $c
if ($errors) {
$warningsText = 'Some entities were skipped due to warnings:' . PHP_EOL;
$warningsText .= implode(PHP_EOL, $errors);

$message .= PHP_EOL . $warningsText;

if ($integration->getSynchronizationSettings()->offsetGetOr('logWarnings', false)) {
foreach ($errors as $error) {
$this->logger->error($error);
}
}
}

$status->setCode(Status::STATUS_COMPLETED)->setMessage($message);
} else {
$this->logger->error('Errors were occurred:');
$this->logger->error('Errors have occurred:');
$exceptions = implode(PHP_EOL, $exceptions);

$this->logger->error($exceptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ integrations:
oro.integration.integration.remote_wins.label: remote
oro.integration.integration.local_wins.label: local
applicable: "@oro_integration.utils.form_utils->hasTwoWaySyncConnectors($channelType$)"
logWarnings:
type: Symfony\Component\Form\Extension\Core\Type\CheckboxType
options:
label: oro.integration.integration.log_warnings.label
tooltip: oro.integration.integration.log_warnings.tooltip
required: false
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ oro:
sync_priority.tooltip: >
Select if your local version of the data or the remote application
data get priority in the case that both were updated since the last sync process.
log_warnings.label: Log warnings as errors
log_warnings.tooltip: Select if you want warnings during sync to be logged as if they were errors.
remote_wins.label: Remote wins
local_wins.label: Local wins
default_user_owner.label: Default owner
Expand Down