Skip to content
Closed
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
64 changes: 64 additions & 0 deletions src/Mapping/Operator/Simple/SumNumbersArray.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (https://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/

namespace Pimcore\Bundle\DataImporterBundle\Mapping\Operator\Simple;

use Pimcore\Bundle\DataImporterBundle\Exception\InvalidConfigurationException;
use Pimcore\Bundle\DataImporterBundle\Mapping\Operator\AbstractOperator;
use Pimcore\Bundle\DataImporterBundle\Mapping\Type\TransformationDataTypeService;

class SumNumbersArray extends AbstractOperator
{
public function setSettings(array $settings): void
{
// No settings required
}

/**
* @param mixed $inputData
* @param bool $dryRun
*
* @return array|false|mixed|null
*/
public function process($inputData, bool $dryRun = false)
{
if (!is_array($inputData) && !empty($inputData)) {
$inputData = [$inputData];
}

$sumOfValues = 0;

Check warning on line 38 in src/Mapping/Operator/Simple/SumNumbersArray.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "$sumOfValues" local variable.

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6ipPU4l3pg_Dr4q&open=AZ1EY6ipPU4l3pg_Dr4q&pullRequest=580
array_walk_recursive($inputData, function ($item) use (&$sumOfValues) {

Check warning on line 39 in src/Mapping/Operator/Simple/SumNumbersArray.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused "$sumOfValues" local variable.

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6ipPU4l3pg_Dr4r&open=AZ1EY6ipPU4l3pg_Dr4r&pullRequest=580
if (is_numeric($item)) {
sumOfValues += $item;

Check failure on line 41 in src/Mapping/Operator/Simple/SumNumbersArray.php

View workflow job for this annotation

GitHub Actions / static-analysis / Static Analysis with PHPStan (8.5, highest, 2026.x-dev as 2026.99.9, true, true)

Syntax error, unexpected T_PLUS_EQUAL on line 41

Check failure on line 41 in src/Mapping/Operator/Simple/SumNumbersArray.php

View workflow job for this annotation

GitHub Actions / static-analysis / Static Analysis with PHPStan (8.4, lowest, false, true)

Syntax error, unexpected T_PLUS_EQUAL on line 41

Check failure on line 41 in src/Mapping/Operator/Simple/SumNumbersArray.php

View workflow job for this annotation

GitHub Actions / static-analysis / Static Analysis with PHPStan (8.5, highest, false, true)

Syntax error, unexpected T_PLUS_EQUAL on line 41
}
});

return $sumOfValuesl;

Check warning on line 45 in src/Mapping/Operator/Simple/SumNumbersArray.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Review the data-flow - use of uninitialized value.

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6ipPU4l3pg_Dr4s&open=AZ1EY6ipPU4l3pg_Dr4s&pullRequest=580
}

/**
* @param string $inputType
* @param int|null $index
*
* @return string
*
* @throws InvalidConfigurationException
*/
public function evaluateReturnType(string $inputType, ?int $index = null): string
{
if ($inputType !== TransformationDataTypeService::DEFAULT_ARRAY) {
throw new InvalidConfigurationException(sprintf("Unsupported input type '%s' for sum number array operator at transformation position %s", $inputType, $index));

Check warning on line 59 in src/Mapping/Operator/Simple/SumNumbersArray.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 172 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6ipPU4l3pg_Dr4p&open=AZ1EY6ipPU4l3pg_Dr4p&pullRequest=580
}

return TransformationDataTypeService::DEFAULT_ARRAY;
}
}
102 changes: 100 additions & 2 deletions src/PimcoreDataImporterBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
namespace Pimcore\Bundle\DataImporterBundle;

use League\FlysystemBundle\FlysystemBundle;
use Pimcore\Bundle\AdminBundle\PimcoreAdminBundle;
use Pimcore\Bundle\ApplicationLoggerBundle\PimcoreApplicationLoggerBundle;
use Pimcore\Bundle\DataHubBundle\PimcoreDataHubBundle;
use Pimcore\Bundle\DataImporterBundle\DependencyInjection\CompilerPass\CleanupStrategyConfigurationFactoryPass;
Expand All @@ -23,14 +24,17 @@
use Pimcore\Bundle\DataImporterBundle\DependencyInjection\PimcoreDataImporterExtension;
use Pimcore\Extension\Bundle\AbstractPimcoreBundle;
use Pimcore\Extension\Bundle\Installer\InstallerInterface;
use Pimcore\Extension\Bundle\PimcoreBundleAdminClassicInterface;
use Pimcore\Extension\Bundle\Traits\BundleAdminClassicTrait;
use Pimcore\Extension\Bundle\Traits\PackageVersionTrait;
use Pimcore\HttpKernel\Bundle\DependentBundleInterface;
use Pimcore\HttpKernel\BundleCollection\BundleCollection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;

class PimcoreDataImporterBundle extends AbstractPimcoreBundle implements DependentBundleInterface
class PimcoreDataImporterBundle extends AbstractPimcoreBundle implements DependentBundleInterface, PimcoreBundleAdminClassicInterface

Check warning on line 35 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 133 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4t&open=AZ1EY6lpPU4l3pg_Dr4t&pullRequest=580
{
use BundleAdminClassicTrait;
use PackageVersionTrait;

const LOGGER_COMPONENT_PREFIX = 'DATA-IMPORTER ';
Expand All @@ -45,6 +49,99 @@
return new PimcoreDataImporterExtension();
}

/**
* @return string[]
*/
public function getCssPaths(): array
{
return [
'/bundles/pimcoredataimporter/css/icons.css'
];
}

/**
* @return string[]
*/
public function getJsPaths(): array
{
return [
'/bundles/pimcoredataimporter/js/pimcore/helper/ext_extensions.js',
'/bundles/pimcoredataimporter/js/pimcore/helper/abstractOptionType.js',
'/bundles/pimcoredataimporter/js/pimcore/adapter/dataImporterDataObject.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/configEvents.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/configItemDataObject.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/loader/sftp.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/loader/http.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/loader/asset.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/loader/upload.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/loader/push.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/loader/sql.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/interpreter/csv.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/interpreter/json.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/interpreter/xlsx.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/interpreter/xml.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/interpreter/sql.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/cleanup/unpublish.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/cleanup/delete.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/importSettings.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/importPreview.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/load/id.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/load/path.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/load/attribute.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/load/notLoad.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/location/staticPath.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/location/findParent.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/location/findOrCreateFolder.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/location/noChange.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/location/doNotCreate.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/publish/alwaysPublish.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/publish/attributeBased.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/publish/noChangePublishNew.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/resolver/publish/noChangeUnpublishNew.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/mappingConfiguration.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/mappingConfigurationItem.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/transformationResultHandler.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/datatarget/direct.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/datatarget/manyToManyRelation.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/datatarget/classificationstore.js',

Check warning on line 106 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 121 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4u&open=AZ1EY6lpPU4l3pg_Dr4u&pullRequest=580
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/datatarget/classificationstoreBatch.js',

Check warning on line 107 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 126 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4v&open=AZ1EY6lpPU4l3pg_Dr4v&pullRequest=580
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/tools/classificationStoreKeySearchWindow.js',

Check warning on line 108 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 131 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4w&open=AZ1EY6lpPU4l3pg_Dr4w&pullRequest=580
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/abstractOperator.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/trim.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/numeric.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asArray.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asCountries.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asGeopoint.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asGeobounds.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asGeopolygon.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asGeopolyline.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/asColor.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/explode.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/combine.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/htmlDecode.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/quantityValue.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/quantityValueArray.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/inputQuantityValue.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/inputQuantityValueArray.js',

Check warning on line 125 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 123 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4x&open=AZ1EY6lpPU4l3pg_Dr4x&pullRequest=580
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/boolean.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/date.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/importAsset.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/loadAsset.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/gallery.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/imageAdvanced.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/loadDataObject.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/objectField.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/reduceArrayKeyValuePairs.js',

Check warning on line 134 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 124 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4y&open=AZ1EY6lpPU4l3pg_Dr4y&pullRequest=580
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/flattenArray.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/staticText.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/conditionalConversion.js',

Check warning on line 137 in src/PimcoreDataImporterBundle.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 121 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=pimcore_data-importer&issues=AZ1EY6lpPU4l3pg_Dr4z&open=AZ1EY6lpPU4l3pg_Dr4z&pullRequest=580
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/stringReplace.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/mapping/operator/sumNumbersArray.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/execution.js',
'/bundles/pimcoredataimporter/js/pimcore/configuration/components/logTab.js',
];
}

public function build(ContainerBuilder $container): void
{
$container
Expand All @@ -60,6 +157,7 @@
{
$collection->addBundle(PimcoreDataHubBundle::class, 20);
$collection->addBundle(new FlysystemBundle());
$collection->addBundle(new PimcoreAdminBundle(), 60);
$collection->addBundle(
PimcoreApplicationLoggerBundle::class,
10
Expand All @@ -70,4 +168,4 @@
{
return $this->container->get(Installer::class);
}
}
}
4 changes: 4 additions & 0 deletions src/Resources/config/services/mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ services:
Pimcore\Bundle\DataImporterBundle\Mapping\Operator\Simple\Explode:
tags:
- { name: "pimcore.datahub.data_importer.operator", type: "explode" }

Pimcore\Bundle\DataImporterBundle\Mapping\Operator\Simple\SumNumbersArray:
tags:
- { name: "pimcore.datahub.data_importer.operator", type: "sumNumbersArray" }

Pimcore\Bundle\DataImporterBundle\Mapping\Operator\Simple\StaticText:
tags:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* This source file is available under the terms of the
* Pimcore Open Core License (POCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.com)
* @license Pimcore Open Core License (POCL)
*/

pimcore.registerNS("pimcore.plugin.pimcoreDataImporterBundle.configuration.components.mapping.operator.sumNumbersArray");
pimcore.plugin.pimcoreDataImporterBundle.configuration.components.mapping.operator.sumNumbersArray = Class.create(pimcore.plugin.pimcoreDataImporterBundle.configuration.components.mapping.abstractOperator, {

type: 'sumNumbersArray',

getMenuGroup: function() {
return this.menuGroups.dataManipulation;
},

getFormItems: function() {

}

});

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"entrypoints": {
"main": {
"js": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/main.ff46a9d7.js"
],
"css": []
},
"pimcore_dataimporter_bundle": {
"js": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/async/__federation_expose_default_export.e496f2a8.js",
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/remoteEntry.js"
],
"css": []
},
"exposeRemote": {
"js": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/exposeRemote.js"
],
"css": []
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
window.pluginRemotes = {}
}

window.pluginRemotes.pimcore_dataimporter_bundle = "/bundles/pimcoredataimporter/studio/build/0abf3e99-e17b-4df9-9475-35bce12db225/static/js/remoteEntry.js"
window.pluginRemotes.pimcore_dataimporter_bundle = "/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/remoteEntry.js"

Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html><head><title>Rsbuild App</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/bundles/pimcoredataimporter/studio/build/0abf3e99-e17b-4df9-9475-35bce12db225/static/js/main.ff46a9d7.js"></script></head><body><div id="root"></div></body></html>
<!DOCTYPE html><html><head><title>Rsbuild App</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/main.ff46a9d7.js"></script></head><body><div id="root"></div></body></html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"allFiles": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/main.ff46a9d7.js",
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/remoteEntry.js",
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/async/__federation_expose_default_export.e496f2a8.js",
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/mf-stats.json",
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/mf-manifest.json",
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/main.html"
],
"entries": {
"main": {
"html": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/main.html"
],
"initial": {
"js": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/main.ff46a9d7.js"
]
}
},
"pimcore_dataimporter_bundle": {
"initial": {
"js": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/remoteEntry.js"
]
},
"async": {
"js": [
"/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/static/js/async/__federation_expose_default_export.e496f2a8.js"
]
}
}
},
"integrity": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"globalName": "pimcore_dataimporter_bundle",
"pluginVersion": "0.14.3",
"prefetchInterface": false,
"publicPath": "/bundles/pimcoredataimporter/studio/build/0abf3e99-e17b-4df9-9475-35bce12db225/"
"publicPath": "/bundles/pimcoredataimporter/studio/build/1c5d222c-0a0a-4016-ba45-b10512cbc05d/"
},
"shared": [],
"remotes": [
Expand Down
Loading
Loading