Skip to content

Commit 8bf095e

Browse files
committed
feat: refactoring
1 parent 3c1235d commit 8bf095e

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

components/ImportExportBundle/src/bundle/Resources/config/item_value_transformer/transformers.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,7 @@ services:
6464
AlmaviaCX\Bundle\IbexaImportExport\Item\ValueTransformer\Ibexa\HtmlToTextBlockTransformer:
6565
tags:
6666
- { name: almaviacx.import_export.item.value_transformer, alias: almaviacx.import_export.item.value_transformer.html_to_textblock}
67+
68+
AlmaviaCX\Bundle\IbexaImportExport\Item\ValueTransformer\Utils\DefaultTransformer:
69+
tags:
70+
- { name: almaviacx.import_export.item.value_transformer, alias: almaviacx.import_export.item.value_transformer.default}

components/ImportExportBundle/src/bundle/Resources/views/themes/admin/import_export/job/list.html.twig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,17 @@
8080
}]) %}
8181

8282
{% set progress_bar %}
83-
{% include '@ibexadesign/import_export/components/progress_bar.html.twig' with {processedCount: job.lastExecution.workflowState.offset, totalCount: job.lastExecution.workflowState.totalItemsCount} only %}
83+
{% if job.lastExecution %}
84+
{% include '@ibexadesign/import_export/components/progress_bar.html.twig' with {processedCount: job.lastExecution.workflowState.offset, totalCount: job.lastExecution.workflowState.totalItemsCount} only %}
85+
{% endif %}
8486
{% endset %}
8587
{% set body_row_cols = body_row_cols|merge([{
8688
content: progress_bar,
8789
raw: true,
8890
}]) %}
8991

9092
{% set body_row_cols = body_row_cols|merge([
91-
{ content: status[job.lastExecution.status] },
93+
{ content: job.lastExecution ? status[job.lastExecution.status] : null },
9294
{ content: job.requestedDate|ibexa_full_datetime },
9395
]) %}
9496

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace AlmaviaCX\Bundle\IbexaImportExport\Item\ValueTransformer\Utils;
6+
7+
use AlmaviaCX\Bundle\IbexaImportExport\Item\ValueTransformer\AbstractItemValueTransformer;
8+
use Symfony\Component\OptionsResolver\OptionsResolver;
9+
10+
class DefaultTransformer extends AbstractItemValueTransformer
11+
{
12+
protected function transform(mixed $value, array $options = [])
13+
{
14+
return $value ?? $options['default_value'];
15+
}
16+
17+
protected function configureOptions(OptionsResolver $optionsResolver): void
18+
{
19+
parent::configureOptions($optionsResolver);
20+
$optionsResolver->define('default_value')
21+
->default(null);
22+
}
23+
}

components/ImportExportBundle/src/lib/Writer/Ibexa/Content/IbexaContentUpdater.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ protected function handleLocation(
117117

118118
foreach ($existingLocations as $existingLocation) {
119119
if ($existingLocation->parentLocationId === $parentLocationId) {
120+
if ($existingLocation->hidden !== $hidden) {
121+
if ($hidden) {
122+
$this->repository->getLocationService()->hideLocation($existingLocation);
123+
} else {
124+
$this->repository->getLocationService()->unhideLocation($existingLocation);
125+
}
126+
}
127+
120128
return $existingLocation;
121129
}
122130
}

0 commit comments

Comments
 (0)