Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
acumatica
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
acumatica
Commits
84249cb1
Commit
84249cb1
authored
May 3, 2023
by
Dimitris Bozelos
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3357779
Added runner service for entity operations
parent
5e0ce912
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
acumatica.services.yml
+7
-0
7 additions, 0 deletions
acumatica.services.yml
src/EntitySync/Runner/Entity.php
+66
-0
66 additions, 0 deletions
src/EntitySync/Runner/Entity.php
with
73 additions
and
0 deletions
acumatica.services.yml
+
7
−
0
View file @
84249cb1
...
...
@@ -23,6 +23,13 @@ services:
-
'
@logger.channel.acumatica'
-
'
@entity_sync.import.manager'
acumatica.entity_sync_runner.entity
:
class
:
Drupal\acumatica\EntitySync\Runner\Entity
arguments
:
-
'
@entity_type.manager'
-
'
@logger.channel.acumatica'
-
'
@entity_sync.export.entity_manager'
## Subscribers.
acumatica.entity_sync_subscriber.variation_import_remote_entity_mapping
:
class
:
Drupal\acumatica\EventSubscriber\VariationImportRemoteEntityMapping
...
...
...
...
This diff is collapsed.
Click to expand it.
src/EntitySync/Runner/Entity.php
0 → 100644
+
66
−
0
View file @
84249cb1
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\acumatica\EntitySync\Runner
;
use
Drupal\entity_sync
\MachineName\Field\Operation
as
OperationField
;
use
Drupal\entity_sync
\Entity\OperationInterface
;
use
Drupal\entity_sync
\Export\EntityManagerInterface
as
ExportManagerInterface
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Psr\Log\LoggerInterface
;
/**
* Runner for operation configurator plugins that operate on single entities.
*
* Currently only supports exporting individual entities. Support for importing
* individual entities will be added here.
*/
class
Entity
extends
Base
{
/**
* Constructs a new Entity object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* The entity type manager.
* @param \Psr\Log\LoggerInterface $logger
* The module's logger channel.
* @param \Drupal\entity_sync\Export\EntityManagerInterface $exportManager
* The Entity Synchronization entity export manager.
*/
public
function
__construct
(
protected
EntityTypeManagerInterface
$entityTypeManager
,
protected
LoggerInterface
$logger
,
protected
ExportManagerInterface
$exportManager
)
{
parent
::
__construct
(
$this
->
entityTypeManager
,
$this
->
logger
);
}
/**
* {@inheritdoc}
*
* Supported context options are:
* - options (array) An associative array with options to pass to the export
* manager. The operation entity is passed in the context automatically.
*
* @see \Drupal\entity_sync\Import\ManagerInterface::exportLocalEntity()
*/
protected
function
doRun
(
OperationInterface
$operation
,
array
$context
):
void
{
$options
=
$context
[
'options'
]
??
[];
if
(
!
isset
(
$options
[
'context'
]))
{
$options
[
'context'
]
=
[];
}
$options
[
'context'
][
'operation_entity'
]
=
$operation
;
$this
->
exportManager
->
exportLocalEntity
(
$operation
->
bundle
(),
$operation
->
get
(
OperationField
::
ENTITY
)
->
entity
,
$options
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment