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
6ff7500b
Commit
6ff7500b
authored
May 3, 2023
by
Dimitris Bozelos
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3357797
Added support for custom filters in list imports
parent
ea64b7c8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/EntitySync/Api/ObjectClient.php
+15
-6
15 additions, 6 deletions
src/EntitySync/Api/ObjectClient.php
with
15 additions
and
6 deletions
src/EntitySync/Api/ObjectClient.php
+
15
−
6
View file @
6ff7500b
...
...
@@ -73,7 +73,7 @@ class ObjectClient implements ClientInterface {
[],
[
'select'
=>
$this
->
buildOdataOption
(
'select'
,
$options
[
'odata'
]),
'filter'
=>
$this
->
buildOdataFilter
(
$filters
),
'filter'
=>
$this
->
buildOdataFilter
(
$filters
,
$options
[
'odata'
]
),
'expand'
=>
$this
->
buildOdataOption
(
'expand'
,
$options
[
'odata'
]),
]
)
...
...
@@ -170,6 +170,8 @@ class ObjectClient implements ClientInterface {
*
* @param array $filters
* The filters passed to this client.
* @param array $options
* The oData options passed to this client.
*
* @return string|null
* The option formatted as expected by OData v3.0 URL conventions, or NULL
...
...
@@ -179,13 +181,9 @@ class ObjectClient implements ClientInterface {
* type : improvement
* priority : normal
* labels : client, odata
* @I Support custom filters in client options
* type : feature
* priority : normal
* labels : client, odata
* phpcs:enable
*/
protected
function
buildOdataFilter
(
array
$filters
):
?string
{
protected
function
buildOdataFilter
(
array
$filters
,
array
$options
):
?string
{
// Currently we only support one filter group with the `and` operator. We
// need to study the OData protocol a bit more before we can add proper
// support for more groups/operators.
...
...
@@ -207,6 +205,17 @@ class ObjectClient implements ClientInterface {
));
}
// Add other filters.
if
(
isset
(
$options
[
'filter'
]))
{
foreach
(
$options
[
'filter'
]
as
$filter
)
{
$odata_filter
->
add
(
new
Filter
(
$filter
[
'key'
],
$filter
[
'value'
],
$filter
[
'operator'
]
));
}
}
$formatted_odata_filter
=
(
string
)
$odata_filter
;
if
(
$formatted_odata_filter
===
''
)
{
return
NULL
;
...
...
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