You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+79-39Lines changed: 79 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,29 @@
1
1
# Code Rhapsodie eZ Dataflow Bundle
2
2
3
-
EzDataflowBundle is a bundle integrating [Code Rhapsodie Dataflow bundle](https://github.com/code-rhapsodie/dataflow-bundle) into Ibexa 4.0+.
3
+
EzDataflowBundle is a bundle
4
+
integrating [Code Rhapsodie Dataflow bundle](https://github.com/code-rhapsodie/dataflow-bundle) into Ibexa 4.0+.
4
5
Dataflows can be piloted from an interface integrated into the Ibexa backoffice.
5
6
EzDataflow bundle is intended to manage content imports from external data sources.
6
7
7
-
> Note: before using this bundle, please read the [Code Rhapsodie Dataflow bundle documentation](https://github.com/code-rhapsodie/dataflow-bundle/blob/master/README.md).
8
+
> Note: before using this bundle, please read
9
+
> the [Code Rhapsodie Dataflow bundle documentation](https://github.com/code-rhapsodie/dataflow-bundle/blob/master/README.md).
8
10
9
-
> Command line notice: When you use Dataflow commands, **use `--siteaccess` instead of `--connection`** expect for `code-rhapsodie:dataflow:dump-schema` command.
11
+
> Command line notice: When you use Dataflow commands, **use `--siteaccess` instead of `--connection`** expect
12
+
> for `code-rhapsodie:dataflow:dump-schema` command.
13
+
14
+
| eZ Dataflow Version | Ibexa Content Version | Status |
Please refer to the [Code-Rhapsodie Dataflow Bundle installation guide](https://github.com/code-rhapsodie/dataflow-bundle#update-the-database).
67
+
Please refer to
68
+
the [Code-Rhapsodie Dataflow Bundle installation guide](https://github.com/code-rhapsodie/dataflow-bundle#update-the-database).
56
69
57
70
### Step 5: Schedule the job runner
58
71
59
-
Please refer to the [Code-Rhapsodie Dataflow Bundle Queue section](https://github.com/code-rhapsodie/dataflow-bundle#queue).
72
+
Please refer to
73
+
the [Code-Rhapsodie Dataflow Bundle Queue section](https://github.com/code-rhapsodie/dataflow-bundle#queue).
60
74
61
75
## Configuration
62
76
63
-
By default, the `ContentWriter` will publish contents using the `admin` user. If you want to use another user (with sufficient permissions), you can configure it like this:
77
+
By default, the `ContentWriter` will publish contents using the `admin` user. If you want to use another user (with
78
+
sufficient permissions), you can configure it like this:
64
79
65
80
```yaml
66
81
# config/packages/code_rhapsodie_ez_dataflow.yaml
67
82
68
83
code_rhapsodie_ez_dataflow:
69
-
# Integer values are assumed to be user ids, non-integer values are assumed to be user logins
70
-
admin_login_or_id: webmaster
84
+
# Integer values are assumed to be user ids, non-integer values are assumed to be user logins
85
+
admin_login_or_id: webmaster
71
86
```
72
87
73
88
## Define your Dataflow
74
89
75
-
Before using the admin UI to manage your dataflows, you need to define them. Please refer to [Code-Rhapsodie Dataflow type documentation](https://github.com/code-rhapsodie/dataflow-bundle#define-a-dataflow-type).
90
+
Before using the admin UI to manage your dataflows, you need to define them. Please refer
91
+
to [Code-Rhapsodie Dataflow type documentation](https://github.com/code-rhapsodie/dataflow-bundle#define-a-dataflow-type).
76
92
77
93
## Use the ContentWriter
78
94
79
95
To add or update Ibexa contents, you can use the `CodeRhapsodie\EzDataflowBundle\Writer\ContentWriter` writer.
80
96
81
97
### Step 1: Inject the dependencies and add the writer
82
98
83
-
Inject the `ContentWriter` service into the constructor of your DataflowType and add the content writer into the writer list like this:
99
+
Inject the `ContentWriter` service into the constructor of your DataflowType and add the content writer into the writer
100
+
list like this:
84
101
85
102
```php
86
103
// In your DataflowType
@@ -112,31 +129,37 @@ class MyDataflowType extends AbstractDataflowType
112
129
113
130
### Step 2: Add a step for prepare the content
114
131
115
-
To process Ibexa contents into your Dataflow, you need to transform the data into `ContentCreateStructure` or `ContentUpdateStructure` objects.
132
+
To process Ibexa contents into your Dataflow, you need to transform the data into `ContentCreateStructure`
133
+
or `ContentUpdateStructure` objects.
116
134
in order to respectively create or update contents.
117
135
118
136
But, in order to determine if the content already exists or not, you first need to look up for it.
119
137
120
138
One way is to use the remote id to search for the content.
121
139
122
-
In the following example, the remote id pattern is `article-<id>` with the `<id>` replaced by the data id provided by the reader.
140
+
In the following example, the remote id pattern is `article-<id>` with the `<id>` replaced by the data id provided by
141
+
the reader.
123
142
To check if the content exists or not, I use the service `ContentService` provided by Ibexa.
124
143
125
144
The step is added as an anonymous function and has 3 types of return values:
126
145
127
146
* When the step returns `false`, the data is dropped.
128
147
* When the step returns a `ContentCreateStructure`, the data will be saved into a new Ibexa content.
129
-
* When the step returns a `ContentUpdateStructure`, the existing Ibexa content will be updated by overwriting all defined fields in the data.
148
+
* When the step returns a `ContentUpdateStructure`, the existing Ibexa content will be updated by overwriting all
149
+
defined fields in the data.
130
150
131
-
For the new content, you must provide one or more "parent location id" as the 3rd argument of the `ContentCreateStructure` constructor.
151
+
For the new content, you must provide one or more "parent location id" as the 3rd argument of
152
+
the `ContentCreateStructure` constructor.
132
153
133
154
In this example, I have added a new folder to store all articles.
134
155
135
-
To get the location id of the parent Ibexa content, go to the admin UI and select the future parent content, click on the details tabs, and read the "Location id" like this:
156
+
To get the location id of the parent Ibexa content, go to the admin UI and select the future parent content, click on
157
+
the details tabs, and read the "Location id" like this:
> Note: the best practice is to define this parent id in your `parameters.yml` file or your `.env.local` file for each execution environment.
161
+
> Note: the best practice is to define this parent id in your `parameters.yml` file or your `.env.local` file for each
162
+
> execution environment.
140
163
141
164
```php
142
165
// In your DataflowType
@@ -192,11 +215,13 @@ class MyDataflowType extends AbstractDataflowType
192
215
}
193
216
```
194
217
195
-
This example uses `ContentStructureFactory` to check if the content exists and returns the adequate `ContentStrucure` to pass to the content writer.
218
+
This example uses `ContentStructureFactory` to check if the content exists and returns the adequate `ContentStrucure` to
219
+
pass to the content writer.
196
220
197
221
## Use the NotModifiedContentFilter
198
222
199
-
When updating contents, you might want to ignore contents where the update would not result in any actual changes in fields values. In that case, you can add the `NotModifiedContentFilter` as one of your steps.
223
+
When updating contents, you might want to ignore contents where the update would not result in any actual changes in
224
+
fields values. In that case, you can add the `NotModifiedContentFilter` as one of your steps.
This filter compares each field value in the `ContentUpdateStructure` received to the fields values in the existing content object. If all values are identical, this filter will return `false`, otherwise, the `ContentUpdateStructure` will be returned as is.
244
+
This filter compares each field value in the `ContentUpdateStructure` received to the fields values in the existing
245
+
content object. If all values are identical, this filter will return `false`, otherwise, the `ContentUpdateStructure`
246
+
will be returned as is.
220
247
221
-
Not all field types are supported by this filter. Il a field type is not supported, values will be assumed different. If your dataflow is dealing with content types containing unsupported field types, it is better to simply not use the `NotModifiedContentFilter` to prevent unnecessary overhead.
248
+
Not all field types are supported by this filter. Il a field type is not supported, values will be assumed different. If
249
+
your dataflow is dealing with content types containing unsupported field types, it is better to simply not use
250
+
the `NotModifiedContentFilter` to prevent unnecessary overhead.
222
251
223
252
### Supported field types
253
+
224
254
- ezstring
225
255
- ezauthor
226
256
- ezboolean
@@ -267,10 +297,10 @@ class MyFieldComparator extends AbstractFieldComparator
@@ -293,33 +323,38 @@ When you access to the eZ Dataflow administration UI, you going here:
293
323
1. Scheduled dataflow list
294
324
1. Button to add a new scheduled dataflow
295
325
1. Tools available for each scheduled dataflow. In order from left to right :
296
-
1. Display the history for this dataflow schedule
297
-
1. Edit this dataflow schedule
298
-
1. Enable/Disable this dataflow schedule
299
-
1. Delete this dataflow schedule
326
+
1. Display the history for this dataflow schedule
327
+
1. Edit this dataflow schedule
328
+
1. Enable/Disable this dataflow schedule
329
+
1. Delete this dataflow schedule
300
330
301
331
> Note: You can define more than one schedule for any given dataflow.
302
332
303
333
## Add a new schedule
304
334
305
-
Go to the eZ Dataflow admin, and click on the "+" orange button.
335
+
Go to the eZ Dataflow admin, and click on the "+" orange button.
306
336
307
337
In the new popin, fill in the fields:
308
338
309
339

310
340
311
341
1. Type the Dataflow schedule name
312
-
1. Select the Dataflow type. The list is automatically generated from the list of Symfony services with the tags `coderhapsodie.dataflow.type`. If your dataflow type is not present, [check the configuration](https://github.com/code-rhapsodie/dataflow-bundle#check-if-your-dataflowtype-is-ready)
313
-
1. Type here the Dataflow options. Basic expected format: one option per line and option name and value separated with `: `. For more complex options, the whole YAML format is supported.
314
-
1. Type here the frequency. The value must be compatible with the the PHP [strtotime](https://www.php.net/manual/en/function.strtotime.php) function.
342
+
1. Select the Dataflow type. The list is automatically generated from the list of Symfony services with the
343
+
tags `coderhapsodie.dataflow.type`. If your dataflow type is not
344
+
present, [check the configuration](https://github.com/code-rhapsodie/dataflow-bundle#check-if-your-dataflowtype-is-ready)
345
+
1. Type here the Dataflow options. Basic expected format: one option per line and option name and value separated
346
+
with `: `. For more complex options, the whole YAML format is supported.
347
+
1. Type here the frequency. The value must be compatible with the the
1. Select the Dataflow type. The list is automatically generated from the list of Symfony services with the tags `coderhapsodie.dataflow.type`. If your dataflow type is not present, [check the configuration](https://github.com/code-rhapsodie/dataflow-bundle#check-if-your-dataflowtype-is-ready)
360
-
1. Type here the Dataflow options. Basic expected format: one option per line and option name and value separated with `: `. For more complex options, the whole YAML format is supported.
394
+
1. Select the Dataflow type. The list is automatically generated from the list of Symfony services with the
395
+
tags `coderhapsodie.dataflow.type`. If your dataflow type is not
396
+
present, [check the configuration](https://github.com/code-rhapsodie/dataflow-bundle#check-if-your-dataflowtype-is-ready)
397
+
1. Type here the Dataflow options. Basic expected format: one option per line and option name and value separated
398
+
with `: `. For more complex options, the whole YAML format is supported.
361
399
1. Choose the date and time of the first job.
362
400
363
401
Finally, click on the "Create" button.
364
402
365
403
# Rights
366
404
367
-
If a non-administrator user needs read-only access to the dataflow interface, add the `Setup / Administrate` and `eZ Dataflow / View` policies in one of their roles.
405
+
If a non-administrator user needs read-only access to the dataflow interface, add the `Setup / Administrate`
406
+
and `eZ Dataflow / View` policies in one of their roles.
368
407
369
408
# Issues and feature requests
370
409
@@ -373,7 +412,8 @@ Please report issues and request features at https://github.com/code-rhapsodie/e
373
412
# Contributing
374
413
375
414
Contributions are very welcome. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for
376
-
details. Thanks to [everyone who has contributed](https://github.com/code-rhapsodie/ezdataflow-bundle/graphs/contributors)
415
+
details. Thanks
416
+
to [everyone who has contributed](https://github.com/code-rhapsodie/ezdataflow-bundle/graphs/contributors)
0 commit comments