Support OR conditions for content extract
What does it do ?
With this change it's possible to define OR conditions in the .gitify config for content extraction. The config could look like this:
contents:
type: content
where:
-
'context_key:IN': [web,othercontext]
-
'OR:parent:IN': [480,510]
Why is it needed ?
Previously the condition for the current extracting context was added like this $contextCriteria['context_key'] = $contextKey; - this would destroy the array structure that is needed for the OR condition. With OR conditions you need to add conditions into the sub-arrays.
Related issue(s)/PR(s)
@Mark-H Can we get this merged? pretty please
@Mark-H Don't we want to merge this? This has been working for us internally since 2016.
I'm also using this change for a while now, but just ran into an issue.
I can't limit the extract to a specific context with the following config:
content:
type: content
exclude_keys:
- editedby
- editedon
truncate_on_force:
- modTemplateVarResource
where:
- 'context_key': 'global'
All contexts are extracted in this case. Reverting the changes in this PR solves it.
Changing the where clause to 'context_key:IN': [global] solves it too btw, as a temporary workaround..
Might be more logical to filter one level up (i.e. here). The way content is extracted is grouped into directories by context, so if we don't want certain contexts... just don't load those contexts.
That could be a new property on the content definition, like:
contents:
type: content
contexts: [web, othercontext]
I don't know why I left this one so long, sorry.