Skip to content

Commit e228262

Browse files
committed
Added context into the custom connector documentation
1 parent 0d8df5a commit e228262

File tree

1 file changed

+27
-138
lines changed

1 file changed

+27
-138
lines changed

content/connectivity/custom/_index.en.md

Lines changed: 27 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -33,169 +33,58 @@ This plugin is already integrated into the Satellite package, so you can’t req
3333

3434
Unlike other plugins, the configuration is the same whether it is an extractor, a transformer or a loader.
3535

36-
First you need to [determine your services](../../feature/services) in your pipeline or workflow and then use the `use`
37-
option which allows you to define which service to use.
38-
3936
### Building an extractor
4037

38+
In the example given, we explain how to configure a custom extractor with the `Bar` class located in the `App\Class` namespace.
39+
40+
Here's a more detailed explanation:
41+
4142
```yaml
4243
custom:
4344
extractor:
44-
use: 'App\Class\Bar'
45+
use: 'App\Class\Bar' # This line specifies the extractor class you want to use.
4546
services:
46-
App\Class\Bar: ~
47+
App\Class\Bar: ~ # Here, we declare the service associated with the Bar class with the syntax App\Class\Bar: ~. This simply indicates that we want to use the default parameters for this service.
4748
```
4849
50+
For more details about service configurations, please visit the [declaring-services](../../feature/services) documentation.
51+
4952
### Building a transformer
5053
54+
In the example given, we explain how to configure a custom extractor with the `Bar` class located in the `App\Class` namespace.
55+
56+
Here's a more detailed explanation:
57+
5158
```yaml
5259
custom:
5360
transformer:
54-
use: 'App\Class\Bar'
61+
use: 'App\Class\Bar' # This line specifies the extractor class you want to use.
5562
services:
56-
App\Class\Bar:
57-
factory:
63+
App\Class\Bar: # Here, we declare the service associated with the Bar class.
64+
factory: # This section indicates that the service must be created by calling the extract method of the App\Class\Bar class.
5865
class: App\Class\Bar
5966
method: extract
60-
arguments:
67+
arguments: # The arguments to be passed to the extract method. In this example, the @foo symbol indicates that the foo service should be injected as an argument. Make sure that the foo service is configured correctly elsewhere in your pipeline.
6168
- '@foo'
69+
foo: ~
6270
```
6371

64-
### Building a loader
65-
66-
```yaml
67-
custom:
68-
loader:
69-
use: 'App\Class\Bar'
70-
services:
71-
App\Class\Bar:
72-
calls:
73-
- withUsername: [ 'admin' ]
74-
```
75-
76-
## Usage examples
77-
78-
Some examples of pipeline with Magento to extract, FastMap to transform and ZohoCRM to load data
72+
For more details about service configurations, please visit the [declaring-services](../../feature/services) documentation.
7973

80-
### Example of an extractor
81-
82-
```yaml
83-
custom:
84-
extractor:
85-
use: 'App\Component\Flow\Magento2\CustomerExtractor'
86-
services:
87-
App\Component\Flow\Magento2\CustomerExtractor:
88-
arguments:
89-
- '@Monolog\Logger'
90-
- ['@firstname_filter_group_1', '@firstname_filter_group_2']
91-
public: true
92-
firstname_filter_group_1:
93-
class: App\Component\Flow\Magento2\FilterGroup
94-
calls:
95-
- withFilter: [ '@firstname_filter_1' ]
96-
firstname_filter_1:
97-
class: App\Component\Flow\Magento2\Filter
98-
arguments:
99-
- 'firstname'
100-
- 'nlike'
101-
- '%bm01.cc'
102-
firstname_filter_group_2:
103-
class: App\Component\Flow\Magento2\FilterGroup
104-
calls:
105-
- withFilter: [ '@firstname_filter_2' ]
106-
firstname_filter_2:
107-
class: App\Component\Flow\Magento2\Filter
108-
arguments:
109-
$field: 'firstname'
110-
$conditionType: 'nlike'
111-
$value: '%.xyz'
112-
Monolog\Logger:
113-
arguments:
114-
- 'app'
115-
- [ '@Monolog\Handler\StreamHandler' ]
116-
Monolog\Handler\StreamHandler:
117-
arguments:
118-
- 'var/dev.log'
119-
- 300
120-
```
74+
### Building a loader
12175

122-
You can write the arguments of your service in 2 different ways.
123-
You can list them with a '-' but you need to respect the order of the arguments in the constructor,
124-
or you can simply name the arguments by their variable name in the constructor.
125-
126-
#### Filter class constructor :
127-
```php
128-
class Filter
129-
{
130-
public function __construct(
131-
public string $field,
132-
public string $conditionType,
133-
public string $value,
134-
) {
135-
}
136-
}
137-
```
76+
In the example given, we explain how to configure a custom extractor with the `Bar` class located in the `App\Class` namespace.
13877

139-
### Example of a transformer
140-
```yaml
141-
custom:
142-
transformer:
143-
use: 'App\CachedAttributeLookup'
144-
services:
145-
PDO:
146-
arguments:
147-
- 'mysql:host=127.0.0.1;port=3306;dbname=lacelier'
148-
- 'user'
149-
- 'password'
150-
App\CachedAttributeLookup:
151-
arguments:
152-
- '@PDO'
153-
- 'SELECT * FROM color WHERE region=:region AND code=:code'
154-
- '@Cache\Adapter\Apcu\ApcuCachePool'
155-
- 'color'
156-
- '@App\ColorLookupMapper'
157-
public: true
158-
App\ColorLookupMapper: ~
159-
Cache\Adapter\Apcu\ApcuCachePool: ~
160-
Symfony\Component\Cache\Adapter\ApcuAdapter: ~
161-
```
78+
Here's a more detailed explanation:
16279

163-
### Example of a loader
16480
```yaml
16581
custom:
16682
loader:
167-
use: 'App\Component\Flow\ZohoCRM\ContactLoader'
83+
use: 'App\Class\Bar' # This line specifies the extractor class you want to use.
16884
services:
169-
App\Component\Flow\ZohoCRM\ContactLoader:
170-
arguments:
171-
- '@App\Component\Flow\ZohoCRM\Client\Client'
172-
- '@Monolog\Logger'
173-
public: true
174-
GuzzleHttp\Client: ~
175-
GuzzleHttp\Psr7\HttpFactory: ~
176-
App\Component\Flow\ZohoCRM\Client\AuthenticationMiddleware:
177-
arguments:
178-
- '@GuzzleHttp\Client'
179-
- '@GuzzleHttp\Psr7\HttpFactory'
180-
- '@GuzzleHttp\Psr7\HttpFactory'
181-
- '%env(ZOHO_OAUTH_HOST)%'
182-
- '%env(ZOHO_CLIENT_ID)%'
183-
- '%env(ZOHO_CLIENT_SECRET)%'
184-
- '%env(ZOHO_ACCESS_TOKEN)%'
185-
- '%env(ZOHO_REFRESH_TOKEN)%'
186-
App\Component\Flow\ZohoCRM\Client\Client:
187-
arguments:
188-
- '%env(ZOHO_BASE_HOST)%'
189-
- '@App\Component\Flow\ZohoCRM\Client\AuthenticationMiddleware'
190-
- '@GuzzleHttp\Psr7\HttpFactory'
191-
- '@GuzzleHttp\Psr7\HttpFactory'
192-
- '@GuzzleHttp\Psr7\HttpFactory'
193-
Monolog\Logger:
194-
arguments:
195-
- 'app'
196-
- [ '@Monolog\Handler\StreamHandler' ]
197-
Monolog\Handler\StreamHandler:
198-
arguments:
199-
- 'var/dev.log'
200-
- 300
85+
App\Class\Bar: # Here, we declare the service associated with the Bar class.
86+
calls: # This section indicates that specific method calls must be made to the service instance.
87+
- withUsername: [ 'admin' ] # This means that a method call named withUsername must be made to the instance of the Bar class, with the username "admin" passed as an argument.
20188
```
89+
90+
For more details about service configurations, please visit the [declaring-services](../../feature/services) documentation.

0 commit comments

Comments
 (0)