Skip to content

Commit

Permalink
Merge branch '4.0' into 5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dpfaffenbauer committed Jul 17, 2024
2 parents 180e3e7 + c841fde commit 0b6dfe1
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->scalarNode('cleaner')->end()
->scalarNode('key')->end()
->scalarNode('filter')->end()
->scalarNode('persister')->end()
->booleanNode('renameExistingObjects')->end()
->booleanNode('relocateExistingObjects')->end()
->booleanNode('skipNewObjects')->end()
Expand Down
6 changes: 6 additions & 0 deletions src/DataDefinitionsBundle/Exporter/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Exception;
use InvalidArgumentException;
use Pimcore;
use Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Concrete;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -116,6 +117,9 @@ private function runExport(
FetcherInterface $fetcher,
ExportProviderInterface $provider
) {
$getInheritedValues = DataObject::getGetInheritedValues();
DataObject::setGetInheritedValues($definition->isEnableInheritance());

UnpublishedHelper::hideUnpublished(
function () use ($definition, $params, $total, $fetcher, $provider, $fetcherContext) {
$count = 0;
Expand Down Expand Up @@ -180,6 +184,8 @@ function () use ($definition, $params, $total, $fetcher, $provider, $fetcherCont
},
false === $definition->isFetchUnpublished()
);

DataObject::setGetInheritedValues($getInheritedValues);
}

private function exportRow(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
->add('runner', ExportRunnerChoiceType::class)
->add('name', TextType::class)
->add('stopOnException', CheckboxType::class)
->add('enableInheritance', CheckboxType::class)
->add('fetchUnpublished', CheckboxType::class)
->add('failureNotificationDocument', IntegerType::class)
->add('successNotificationDocument', IntegerType::class)
Expand Down
21 changes: 21 additions & 0 deletions src/DataDefinitionsBundle/Model/ExportDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
*/
class ExportDefinition extends AbstractDataDefinition implements ExportDefinitionInterface
{
/**
* @var bool
*/
public $enableInheritance = true;

/**
* @var string
*/
Expand Down Expand Up @@ -54,6 +59,22 @@ public static function getByName($id)
return $definitionEntry;
}

/**
* @param bool $enableInheritance
*/
public function setEnableInheritance(bool $enableInheritance): void
{
$this->enableInheritance = $enableInheritance;
}

/**
* @return bool
*/
public function isEnableInheritance(): bool
{
return $this->enableInheritance;
}

public function getFetcher()
{
return $this->fetcher;
Expand Down
1 change: 1 addition & 0 deletions src/DataDefinitionsBundle/Model/ExportDefinition/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public function save()
'mapping',
'runner',
'stopOnException',
'enableInheritance',
'fetchUnpublished',
'failureNotificationDocument',
'successNotificationDocument',
Expand Down
10 changes: 10 additions & 0 deletions src/DataDefinitionsBundle/Model/ExportDefinitionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@

interface ExportDefinitionInterface extends DataDefinitionInterface
{
/**
* @param bool $enableInheritance
*/
public function setEnableInheritance(bool $enableInheritance): void;

/**
* @return bool
*/
public function isEnableInheritance(): bool;

/**
* @return mixed
*/
Expand Down
1 change: 1 addition & 0 deletions src/DataDefinitionsBundle/Model/ImportDefinition/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ public function save()
'forceLoadObject',
'loader',
'fetcher',
'persister',
];

foreach ($dataRaw as $key => $value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ Instride\Bundle\DataDefinitionsBundle\Model\ExportDefinition:
exclusion_policy: ALL
xml_root_name: export_definition
properties:
enableInheritance:
expose: true
type: boolean
groups: [Detailed]
fetcher:
expose: true
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ Instride\Bundle\DataDefinitionsBundle\Model\ImportDefinition:
expose: true
type: boolean
groups: [ Detailed ]
persister:
expose: true
type: string
groups: [ Detailed ]
virtual_properties:
isWriteable:
exp: object.isWriteable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ pimcore.plugin.datadefinitions.export.item = Class.create(pimcore.plugin.datadef
name: 'stopOnException',
checked: this.data.stopOnException
},
{
fieldLabel: t('data_definitions_enable_inheritance'),
xtype: 'checkbox',
name: 'enableInheritance',
checked: this.data.enableInheritance
},
{
fieldLabel: t('data_definitions_fetcher_objects_unpublished'),
xtype: 'checkbox',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ data_definitions_filter: 'Filter'
data_definitions_runner: 'Runner'
data_definitions_create_version: 'Create new Version on every Run'
data_definitions_stop_on_exception: 'Stop on Exception'
data_definitions_enable_inheritance: 'Enable Inheritance'
data_definitions_installed: 'ImportDefinitions has been installed'
data_definitions_uninstalled: 'ImportDefinitions has been uninstalled'
data_definitions_success_document: 'Success Notification Document'
Expand Down
11 changes: 6 additions & 5 deletions src/DataDefinitionsBundle/Service/FieldSelection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ public function getClassDefinition(DataObject\ClassDefinition $class): array
$fields = $class->getFieldDefinitions();

$systemColumns = [
'o_published',
'o_key',
'o_parentId',
'o_parent',
'o_type',
'id',
'published',
'key',
'parentId',
'parent',
'type',
];

$result = [];
Expand Down

0 comments on commit 0b6dfe1

Please sign in to comment.