Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
entity_sync_odata
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
entity_sync_odata
Commits
d028402e
Commit
d028402e
authored
1 year ago
by
Dimitris Bozelos
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3409349
Support overriding the entity client
parent
84a1e185
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/EntitySync/Api/EntityClientFactory.php
+14
-0
14 additions, 0 deletions
src/EntitySync/Api/EntityClientFactory.php
with
14 additions
and
0 deletions
src/EntitySync/Api/EntityClientFactory.php
+
14
−
0
View file @
d028402e
...
@@ -42,7 +42,13 @@ use KrystalCode\Api\Session\SessionManagerInterface;
...
@@ -42,7 +42,13 @@ use KrystalCode\Api\Session\SessionManagerInterface;
* - odata: (array, optional) An array containing `select` and `expand` items to
* - odata: (array, optional) An array containing `select` and `expand` items to
* add to the corresponding OData clauses. Currenlty only supported by the
* add to the corresponding OData clauses. Currenlty only supported by the
* `importList` client method. OData filters are not supported yet.
* `importList` client method. OData filters are not supported yet.
* - client_class: (string, optional) The fully qualified name of the client
* class to instantiate. This may be useful in case it is necessary to
* extend/override the client provided by this module; it allows doing so
* without having to write a factory as well. The client class must be
* compatible with the instantiation done in this factory.
*
*
* @see \Drupal\entity_sync_odata\EntitySync\Api\EntityClient::__construct()
* @see \KrystalCode\Api\Session\SessionManagerInterface::setOptions()
* @see \KrystalCode\Api\Session\SessionManagerInterface::setOptions()
* phpcs:disable
* phpcs:disable
* @I Add client adapter for integrations that do not require authentication
* @I Add client adapter for integrations that do not require authentication
...
@@ -84,6 +90,14 @@ class EntityClientFactory implements ProviderClientFactoryInterface {
...
@@ -84,6 +90,14 @@ class EntityClientFactory implements ProviderClientFactoryInterface {
}
}
}
}
if
(
isset
(
$parameters
[
'client_class'
]))
{
return
new
$parameters
[
'client_class'
](
$this
->
getSessionManager
(
$parameters
),
$parameters
[
'entity_type'
],
$parameters
[
'odata'
]
??
[]
);
}
return
new
EntityClient
(
return
new
EntityClient
(
$this
->
getSessionManager
(
$parameters
),
$this
->
getSessionManager
(
$parameters
),
$parameters
[
'entity_type'
],
$parameters
[
'entity_type'
],
...
...
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