Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
42ce4ee
[With or Without IDs][Export] export without IDs (id, parentsId); opt…
mike4git Jul 21, 2025
fa73030
[With or Without IDs][Import] import with or without IDs (id, parents…
mike4git Jul 21, 2025
1dbc699
[With or Without IDs][Export][Documents] Add ignore ID checkbox to menu
mike4git Jul 22, 2025
097669f
[With or Without IDs][Export] manage sequence of exported attributes
mike4git Jul 22, 2025
e1a82bd
[With or Without IDs][Export] export menu adapted for Assets & DataOb…
mike4git Jul 22, 2025
36bc9c2
[With or Without IDs][Export] doc adapted
mike4git Jul 22, 2025
18a0ace
[With or Without IDs][Export] label for checkbox corrected
mike4git Jul 22, 2025
dcf9c6e
[With or Without IDs][Import] use ApplicationLogger for errors and infos
mike4git Jul 22, 2025
c8d32ae
[With or Without IDs][Export] use kebap-case for commandline option
mike4git Jul 22, 2025
b47a1ab
[With or Without IDs][Export] remove unused code in JS
mike4git Jul 22, 2025
73340c7
[With or Without IDs][Export] try to fix integration tests by loading…
mike4git Jul 22, 2025
e36b231
[With or Without IDs][Export] fix tests
mike4git Jul 22, 2025
5da074a
[With or Without IDs][Export] add EventSubscriber, Event Dispatching …
lukadschaak Jul 22, 2025
0b0f28b
[With or Without IDs][Export][Import] fixed all tests, cs and phpstan
mike4git Jul 23, 2025
079b56b
[Exporter][Fix] * include properties * export different Document subt…
mike4git Jul 24, 2025
306ae49
[With or Without IDs][Export] fix phpstan
lukadschaak Jul 25, 2025
385ced0
[With or Without IDs][Export] remove Kernel_CLASS from phpunit.xml.dist
lukadschaak Jul 25, 2025
933956f
[With or Without IDs][Export] fix services
lukadschaak Jul 25, 2025
d210ddd
[With or Without IDs][Export] small clean up
lukadschaak Jul 25, 2025
fb75517
[With or With IDs][Review] some resolved conversations
mike4git Jul 28, 2025
fd5b1dd
[With or With IDs][Review] fix failing tests
mike4git Jul 28, 2025
baa2e8b
[With or With IDs][Review] CodeRabbit review fixed
mike4git Jul 28, 2025
f65536d
Update src/Import/EventSubscriber/StatisticsEventSubscriber.php
mike4git Aug 5, 2025
267f49d
[With or With IDs][Review] by J-Cop
mike4git Aug 5, 2025
bdb2635
[With or With IDs][Review] fixed test for WYSIWYG editable
mike4git Aug 5, 2025
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
6 changes: 4 additions & 2 deletions config/pimcore/export/assets/converters_populators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ neusta_converter:
###########################################################
neusta_pimcore_import_export.export_asset_folder:
target: Neusta\Pimcore\ImportExportBundle\Model\Asset\Asset
populators:
- Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator
properties:
id: ~
key: ~
type: ~
path: ~
parentId: ~

services:
_defaults:
Expand Down Expand Up @@ -87,6 +87,8 @@ services:
###########################################################
# Export Populator (Pimcore Asset -> Asset)
###########################################################
Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator: ~

neusta_pimcore_import_export.asset.filename.populator:
class: Neusta\ConverterBundle\Populator\PropertyMappingPopulator
arguments:
Expand Down
5 changes: 3 additions & 2 deletions config/pimcore/export/documents/converters_populators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ neusta_converter:
- neusta_pimcore_import_export.page.property.language.populator
- neusta_pimcore_import_export.page.property.navigation_title.populator
- neusta_pimcore_import_export.page.property.navigation_name.populator
- Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator
properties:
id: ~
key: ~
type: ~
published: ~
path: ~
parentId: ~
controller: ~

neusta_pimcore_import_export.editable_converter:
Expand Down Expand Up @@ -75,6 +74,8 @@ services:
###########################################################
# Export Populator (Page -> Page)
###########################################################
Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator: ~

neusta_pimcore_import_export.page.title.populator:
class: Neusta\ConverterBundle\Populator\PropertyMappingPopulator
arguments:
Expand Down
11 changes: 9 additions & 2 deletions config/pimcore/export/elements/converters_populators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ neusta_converter:
###########################################################
neusta_pimcore_import_export.export_element:
target: Neusta\Pimcore\ImportExportBundle\Model\Element
populators:
- Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator
properties:
id: ~
key: ~
type: ~
path: ~
parentId: ~

services:
_defaults:
autowire: true
autoconfigure: true

Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator: ~
5 changes: 3 additions & 2 deletions config/pimcore/export/objects/converters_populators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ neusta_converter:
neusta_pimcore_import_export.export_object:
target: Neusta\Pimcore\ImportExportBundle\Model\Object\DataObject
populators:
- Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator
- neusta_pimcore_import_export.export_object.fields.populator
- neusta_pimcore_import_export.export_object.relations.populator
properties:
className: ~
id: ~
key: ~
type: ~
published: ~
path: ~
parentId: ~

neusta_pimcore_import_export.export_object.without.relations:
target: Neusta\Pimcore\ImportExportBundle\Model\Object\DataObject
Expand Down Expand Up @@ -47,6 +46,8 @@ services:
$typeToConverterMap:
Pimcore\Model\DataObject\Concrete: '@neusta_pimcore_import_export.export_object'

Neusta\Pimcore\ImportExportBundle\Populator\IdsPopulator: ~

neusta_pimcore_import_export.export_object.fields.populator:
class: Neusta\Pimcore\ImportExportBundle\Populator\DataObjectExportFieldsPopulator

Expand Down
17 changes: 17 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@ services:
Neusta\Pimcore\ImportExportBundle\Serializer\YamlSerializer: ~
Neusta\Pimcore\ImportExportBundle\Serializer\JsonSerializer: ~

Neusta\Pimcore\ImportExportBundle\Serializer\Normalizer\PrioritizedAttributesNormalizer:
arguments:
$priorities:
- 'type'
- 'id'
- 'parentId'
- 'path'
- 'key'
- 'published'
- 'controller'
- 'language'
- 'navigation_name'
- 'navigation_title'
- 'title'
- 'editables'
tags: [ 'serializer.normalizer' ]

#################
# EventListener #
#################
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<ini name="display_startup_errors" value="On"/>
<ini name="display_errors" value="On"/>
<ini name="error_reporting" value="-1"/>
<env name="KERNEL_CLASS" value="\TestKernel"/>
</php>

<testsuites>
Expand Down
62 changes: 58 additions & 4 deletions public/js/exportAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,64 @@ neusta_pimcore_import_export.plugin.asset.export = Class.create({
iconCls: "pimcore_icon_asset pimcore_icon_overlay_download",
handler: function () {
let defaultFilename = asset.data.key + '.yaml';
let filename = prompt(t('neusta_pimcore_import_export_enter_filename'), defaultFilename);
if (filename) {
pimcore.helpers.download(Routing.generate(route, {asset_id: asset.data.id, filename: filename, format: 'yaml'}));
}
let includeIds = !confirm(t('neusta_pimcore_import_export_exclude_ids_question')); // Yes = false, No = true

let win = Ext.create('Ext.window.Window', {
title: t('neusta_pimcore_import_export_dialog_title'),
modal: true,
width: 400,
layout: 'fit',
items: [{
xtype: 'form',
bodyPadding: 10,
defaults: {
anchor: '100%',
labelAlign: 'top'
},
items: [
{
xtype: 'textfield',
name: 'filename',
fieldLabel: t('neusta_pimcore_import_export_filename_label'),
value: defaultFilename,
allowBlank: false
},
{
xtype: 'checkbox',
name: 'includeIds',
boxLabel: t('neusta_pimcore_import_export_exclude_ids_label') +
' <span class="pimcore_object_label_icon pimcore_icon_gray_info" style="cursor: help;" data-qtip="' +
t('neusta_pimcore_import_export_exclude_ids_info') + '"></span>',
inputValue: true
}
]
}],
buttons: [{
text: t('neusta_pimcore_import_export_dialog_confirm'),
handler: function () {
let form = win.down('form').getForm();
if (form.isValid()) {
let values = form.getValues();
pimcore.helpers.download(
Routing.generate(route, {
asset_id: asset.data.id,
filename: values.filename,
format: 'yaml',
ids_included: !!values.includeIds
})
);
win.close();
}
}
}, {
text: t('neusta_pimcore_import_export_dialog_cancel'),
handler: function () {
win.close();
}
}]
});

win.show();
}
}));
}
Expand Down
62 changes: 58 additions & 4 deletions public/js/exportDataObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,64 @@ neusta_pimcore_import_export.plugin.object.export = Class.create({
iconCls: icon,
handler: function () {
let defaultFilename = object.data.key + '.yaml';
let filename = prompt(t('neusta_pimcore_import_export_enter_filename'), defaultFilename);
if (filename) {
pimcore.helpers.download(Routing.generate(route, {object_id: object.data.id, filename: filename, format: 'yaml'}));
}
let includeIds = !confirm(t('neusta_pimcore_import_export_exclude_ids_question')); // Yes = false, No = true

let win = Ext.create('Ext.window.Window', {
title: t('neusta_pimcore_import_export_dialog_title'),
modal: true,
width: 400,
layout: 'fit',
items: [{
xtype: 'form',
bodyPadding: 10,
defaults: {
anchor: '100%',
labelAlign: 'top'
},
items: [
{
xtype: 'textfield',
name: 'filename',
fieldLabel: t('neusta_pimcore_import_export_filename_label'),
value: defaultFilename,
allowBlank: false
},
{
xtype: 'checkbox',
name: 'includeIds',
boxLabel: t('neusta_pimcore_import_export_exclude_ids_label') +
' <span class="pimcore_object_label_icon pimcore_icon_gray_info" style="cursor: help;" data-qtip="' +
t('neusta_pimcore_import_export_exclude_ids_info') + '"></span>',
inputValue: true
}
]
}],
buttons: [{
text: t('neusta_pimcore_import_export_dialog_confirm'),
handler: function () {
let form = win.down('form').getForm();
if (form.isValid()) {
let values = form.getValues();
pimcore.helpers.download(
Routing.generate(route, {
object_id: object.data.id,
filename: values.filename,
format: 'yaml',
ids_included: !!values.includeIds
})
);
win.close();
}
}
}, {
text: t('neusta_pimcore_import_export_dialog_cancel'),
handler: function () {
win.close();
}
}]
});

win.show();
}
}));
}
Expand Down
61 changes: 57 additions & 4 deletions public/js/exportDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,63 @@ neusta_pimcore_import_export.plugin.document.export = Class.create({
iconCls: icon,
handler: function () {
let defaultFilename = document.data.key + '.yaml';
let filename = prompt(t('neusta_pimcore_import_export_enter_filename'), defaultFilename);
if (filename) {
pimcore.helpers.download(Routing.generate(route, {doc_id: document.data.id, filename: filename, format: 'yaml'}));
}

let win = Ext.create('Ext.window.Window', {
title: t('neusta_pimcore_import_export_dialog_title'),
modal: true,
width: 400,
layout: 'fit',
items: [{
xtype: 'form',
bodyPadding: 10,
defaults: {
anchor: '100%',
labelAlign: 'top'
},
items: [
{
xtype: 'textfield',
name: 'filename',
fieldLabel: t('neusta_pimcore_import_export_filename_label'),
value: defaultFilename,
allowBlank: false
},
{
xtype: 'checkbox',
name: 'includeIds',
boxLabel: t('neusta_pimcore_import_export_exclude_ids_label') +
' <span class="pimcore_object_label_icon pimcore_icon_gray_info" style="cursor: help;" data-qtip="' +
t('neusta_pimcore_import_export_exclude_ids_info') + '"></span>',
inputValue: true
}
]
}],
buttons: [{
text: t('neusta_pimcore_import_export_dialog_confirm'),
handler: function () {
let form = win.down('form').getForm();
if (form.isValid()) {
let values = form.getValues();
pimcore.helpers.download(
Routing.generate(route, {
doc_id: document.data.id,
filename: values.filename,
format: 'yaml',
ids_included: !!values.includeIds
})
);
win.close();
}
}
}, {
text: t('neusta_pimcore_import_export_dialog_cancel'),
handler: function () {
win.close();
}
}]
});

win.show();
}
}));
}
Expand Down
6 changes: 6 additions & 0 deletions src/Command/Base/AbstractExportBaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public function __construct(
protected function configure(): void
{
$this
->addOption(
'includeIds',
null,
InputOption::VALUE_NONE,
'If set, the export will include asset/document/object IDs and ParentIDs - be aware with re-importing'
)
->addOption(
'output',
'o',
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExportAssetsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function configure(): void

protected function exportInFile(array $allElements, InputInterface $input): bool
{
$yamlContent = $this->exporter->export($allElements, $input->getOption('format'));
$yamlContent = $this->exporter->export($allElements, $input->getOption('format'), ['includeIds' => $input->getOption('includeIds')]);

$zipFilename = $input->getOption('output');
try {
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExportDataObjectsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ className: SocialMediaItem

protected function exportInFile(array $allElements, InputInterface $input): bool
{
$yamlContent = $this->exporter->export($allElements, $input->getOption('format'));
$yamlContent = $this->exporter->export($allElements, $input->getOption('format'), ['includeIds' => $input->getOption('includeIds')]);

$exportFilename = $input->getOption('output');
// Validate filename to prevent directory traversal
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExportDocumentsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function configure(): void

protected function exportInFile(array $allElements, InputInterface $input): bool
{
$yamlContent = $this->exporter->export($allElements, $input->getOption('format'));
$yamlContent = $this->exporter->export($allElements, $input->getOption('format'), ['includeIds' => $input->getOption('includeIds')]);

$exportFilename = $input->getOption('output');
// Validate filename to prevent directory traversal
Expand Down
Loading
Loading