Skip to content

Commit

Permalink
Final fix for issue #235
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Nov 1, 2020
1 parent a627237 commit 0cc661d
Show file tree
Hide file tree
Showing 25 changed files with 100 additions and 35 deletions.
4 changes: 3 additions & 1 deletion Core/Executor/ContentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ protected function matchContents($action, $step)
$limit = isset($step->dsl['match_limit']) ? $this->referenceResolver->resolveReference($step->dsl['match_limit']) : 0;
$sort = isset($step->dsl['match_sort']) ? $this->referenceResolver->resolveReference($step->dsl['match_sort']) : array();

return $this->contentMatcher->match($match, $sort, $offset, $limit);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->contentMatcher->match($match, $sort, $offset, $limit, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/ContentTypeGroupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ protected function matchContentTypeGroups($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($step->dsl['match']);

return $this->contentTypeGroupMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->contentTypeGroupMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/ContentTypeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ protected function matchContentTypes($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($match);

return $this->contentTypeMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->contentTypeMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/ContentVersionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ protected function matchVersions($action, $step)
$offset = isset($step->dsl['match_offset']) ? $this->referenceResolver->resolveReference($step->dsl['match_offset']) : 0;
$limit = isset($step->dsl['match_limit']) ? $this->referenceResolver->resolveReference($step->dsl['match_limit']) : 0;

return $this->versionMatcher->match($match, $matchVersions, $sort, $offset, $limit);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->versionMatcher->match($match, $matchVersions, $sort, $offset, $limit, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/LanguageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ protected function matchLanguages($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($step->dsl['match']);

return $this->languageMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->languageMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/LocationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ protected function matchLocations($action, $step)
$limit = isset($step->dsl['match_limit']) ? $this->referenceResolver->resolveReference($step->dsl['match_limit']) : 0;
$sort = isset($step->dsl['match_sort']) ? $this->referenceResolver->resolveReference($step->dsl['match_sort']) : array();

return $this->locationMatcher->match($match, $sort, $offset, $limit);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->locationMatcher->match($match, $sort, $offset, $limit, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/ObjectStateGroupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ protected function matchObjectStateGroups($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($step->dsl['match']);

return $this->objectStateGroupMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->objectStateGroupMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/ObjectStateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ protected function matchObjectStates($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($step->dsl['match']);

return $this->objectStateMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->objectStateMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/RoleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ protected function matchRoles($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($match);

return $this->roleMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->roleMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/SectionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ protected function matchSections($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($step->dsl['match']);

return $this->sectionMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->sectionMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/TagManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ protected function matchTags($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($step->dsl['match']);

return $this->tagMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->tagMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/UserGroupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ protected function matchUserGroups($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($match);

return $this->userGroupMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->userGroupMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Core/Executor/UserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ protected function matchUsers($action, $step)
// convert the references passed in the match
$match = $this->resolveReferencesRecursively($match);

return $this->userMatcher->match($match);
$tolerateMisses = isset($step->dsl['match_tolerate_misses']) ? $this->referenceResolver->resolveReference($step->dsl['match_tolerate_misses']) : false;

return $this->userMatcher->match($match, $tolerateMisses);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions Resources/doc/DSL/ContentTypeGroups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or identifier
identifier: xyz # Identifier/name of new content type group
modification_date: 123 # Optional, custom modification date for the content type group (timestamp)
references: # Optional
Expand Down Expand Up @@ -69,6 +70,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or identifier
references: # Optional. See above for allowed values
expect: one|any|many # Optional. If set, the number of matched items will be validated, and the type of values set to created references will change
# 'one': only one element should be matched; reference values will be scalars
Expand Down
2 changes: 2 additions & 0 deletions Resources/doc/DSL/ContentTypes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or identifier
content_type_group: x # Id or identifier of a new group we want to put the new content type into (this will not remove it from the current group)
remove_content_type_group: x # Id or identifier of a group we want to remove this content type from
default_always_available: true|false # Optional
Expand Down Expand Up @@ -227,6 +228,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or identifier
references: # Optional. See above for allowed values
expect: one|any|many # Optional. If set, the number of matched items will be validated, and the type of values set to created references will change
# 'one': only one element should be matched; reference values will be scalars
Expand Down
2 changes: 2 additions & 0 deletions Resources/doc/DSL/ContentVersions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
type: content_version
mode: delete
match: # Same as for Content update/delete/load actions
match_tolerate_misses: false # Same too
match_versions:
# NB: the migration will not fail if there are no matching versions found for the currently matched Contents
status: string|array # accepted values: draft, archived, published
Expand All @@ -24,6 +25,7 @@
type: content_version
mode: load
match: # Same as for Content update/delete/load actions
match_tolerate_misses: false # Same too
match_versions:
# NB: the migration will not fail if there are no matching versions found for the currently matched Contents
status: string|array # accepted values: draft, archived, published
Expand Down
3 changes: 3 additions & 0 deletions Resources/doc/DSL/Contents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
match_limit: 0 # optional
match_sort: # optional. If set, it has to be an array
- { sort_field: content_id|content_name|modified|published|section_identifier|section_name, sort_order: ASC|DESC }
match_tolerate_misses: false # optional. Do not fail the execution if there is no content matching, when matching by id or identifier
attributes: # the list of attribute identifier value pairs. For the format to use, see above
attribute1: value1
attribute2: value2
Expand Down Expand Up @@ -259,6 +260,7 @@
match_limit: 0 # optional
match_sort: # optional. If set, it has to be an array
- { sort_field: content_id|content_name|modified|published|section_identifier|section_name, sort_order: ASC|DESC }
match_tolerate_misses: false # optional. Do not fail the execution if there is no content matching, when matching by id or identifier
references: # Optional. See above for allowed values
expect: one|any|many # Optional. If set, the number of matched items will be validated, and the type of values set to created references will change
if: # Optional. If set, the migration step will be skipped unless the condition is matched
Expand Down Expand Up @@ -315,6 +317,7 @@
match_limit: 0 # optional
match_sort: # optional. If set, it has to be an array
- { sort_field: content_id|content_name|modified|published|section_identifier|section_name, sort_order: ASC|DESC }
match_tolerate_misses: false # optional. Do not fail the execution if there is no content matching, when matching by id or identifier
# The list in references tells the manager to store specific values for later use by other steps in the current migration.
# NB: these are NEW VARIABLES THAT YOU ARE CREATING. They are not used in the current migration step!
references: # Optional
Expand Down
5 changes: 3 additions & 2 deletions Resources/doc/DSL/Languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or code
name: something
enabled: true|false
# The list in references tells the manager to store specific values for later use by other steps in the current migration.
Expand Down Expand Up @@ -72,6 +73,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or code
name: something
enabled: true|false
# The list in references tells the manager to store specific values for later use by other steps in the current migration.
Expand Down Expand Up @@ -109,8 +111,7 @@
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
not: # matches elements NOT satisfying the wrapped condition
_condition_: value # where _condition_ can be any of ones specified above, including 'and' and 'or'
name: something
enabled: true|false
match_tolerate_misses: false # optional. Do not fail the execution if there is no item matching, when matching by id or code
# The list in references tells the manager to store specific values for later use by other steps in the current migration.
# NB: these are NEW VARIABLES THAT YOU ARE CREATING. They are not used in the current migration step!
references: # Optional
Expand Down
3 changes: 3 additions & 0 deletions Resources/doc/DSL/Locations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
match_limit: 0 # optional
match_sort: # optional. If set, it has to be an array
- { sort_field: depth|is_main|node_id|path|ptiority|visibility, sort_order: ASC|DESC }
match_tolerate_misses: false # optional. Do not fail the execution if there is no location matching, when matching by id or identifier
parent_location: x # Optional The parent location to move the subtree to. Cannot be set at the same time than swap_with_location
# When a non numeric string is used, it is assumed to be a location remote id
is_hidden: true|false # Optional, Set the visibility of the location
Expand Down Expand Up @@ -199,6 +200,7 @@
match_limit: 0 # optional
match_sort: # optional. If set, it has to be an array
- { sort_field: depth|is_main|node_id|path|ptiority|visibility, sort_order: ASC|DESC }
match_tolerate_misses: false # optional. Do not fail the execution if there is no location matching, when matching by id or identifier
# The list in references tells the manager to store specific values for later use by other steps in the current migration.
# NB: these are NEW VARIABLES THAT YOU ARE CREATING. They are not used in the current migration step!
references: # Optional
Expand Down Expand Up @@ -278,6 +280,7 @@
match_limit: 0 # optional
match_sort: # optional. If set, it has to be an array
- { sort_field: depth|is_main|node_id|path|ptiority|visibility, sort_order: ASC|DESC }
match_tolerate_misses: false # optional. Do not fail the execution if there is no location matching, when matching by id or identifier
# The list in references tells the manager to store specific values for later use by other steps in the current migration.
# NB: these are NEW VARIABLES THAT YOU ARE CREATING. They are not used in the current migration step!
references: # Optional
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/DSL/Loops.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Loop steps allow to execute multiple times in a row (a sequence of) other steps.
# Nested loops are supported.
# NB: step execution events are triggered only for the outhermost loop step
# NB: step execution events are triggered only for the outermost loop step

-
type: loop
Expand Down
Loading

0 comments on commit 0cc661d

Please sign in to comment.