Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
migrate_plus
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
migrate_plus
Commits
40013b65
Commit
40013b65
authored
3 years ago
by
Vasyl Kydyba
Committed by
Ivan Doroshenko
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3256823
by v.kydyba: Simplify code for the gate process plugin
parent
66c10109
No related branches found
No related tags found
1 merge request
!32
Issue #3256823: simplify code for the gate process plugin
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Plugin/migrate/process/Gate.php
+4
-4
4 additions, 4 deletions
src/Plugin/migrate/process/Gate.php
with
4 additions
and
4 deletions
src/Plugin/migrate/process/Gate.php
+
4
−
4
View file @
40013b65
...
...
@@ -85,20 +85,20 @@ class Gate extends ProcessPluginBase {
* {@inheritdoc}
*/
public
function
transform
(
$value
,
MigrateExecutableInterface
$migrate_executable
,
Row
$row
,
$destination_property
)
{
if
(
empty
(
$this
->
configuration
[
'valid_keys'
])
&&
!
array_key_exists
(
'valid_keys'
,
$this
->
configuration
))
{
if
(
!
array_key_exists
(
'valid_keys'
,
$this
->
configuration
))
{
throw
new
MigrateException
(
'Gate plugin is missing valid_keys configuration.'
);
}
if
(
empty
(
$this
->
configuration
[
'use_as_key'
])
&&
!
array_key_exists
(
'use_as_key'
,
$this
->
configuration
))
{
if
(
!
array_key_exists
(
'use_as_key'
,
$this
->
configuration
))
{
throw
new
MigrateException
(
'Gate plugin is missing use_as_key configuration.'
);
}
if
(
empty
(
$this
->
configuration
[
'key_direction'
])
&&
!
array_key_exists
(
'key_direction'
,
$this
->
configuration
))
{
if
(
!
array_key_exists
(
'key_direction'
,
$this
->
configuration
))
{
throw
new
MigrateException
(
'Gate plugin is missing key_direction configuration.'
);
}
if
(
!
in_array
(
$this
->
configuration
[
'key_direction'
],
[
'lock'
,
'unlock'
],
TRUE
))
{
throw
new
MigrateException
(
'Gate plugin only accepts the following values for key_direction: lock and unlock.'
);
}
$valid_keys
=
is_
array
(
$this
->
configuration
[
'valid_keys'
])
?
$this
->
configuration
[
'valid_keys'
]
:
[
$this
->
configuration
[
'valid_keys'
]
];
$valid_keys
=
(
array
)
$this
->
configuration
[
'valid_keys'
];
$key
=
$row
->
get
(
$this
->
configuration
[
'use_as_key'
]);
$key_is_valid
=
in_array
(
$key
,
$valid_keys
,
TRUE
);
$key_direction
=
$this
->
configuration
[
'key_direction'
];
...
...
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
register
or
sign in
to comment