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
+78-1Lines changed: 78 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -178,7 +178,7 @@ class MyDataflowType extends AbstractDataflowType
178
178
/**
179
179
* @var ContentStructureFactory
180
180
*/
181
-
private contentStructureFactory;
181
+
private $contentStructureFactory;
182
182
183
183
public function __construct(ContentWriter $contentWriter, ContentStructureFactory $contentStructureFactory)
184
184
{
@@ -213,6 +213,83 @@ class MyDataflowType extends AbstractDataflowType
213
213
214
214
This example uses `ContentStructureFactory` to check if the content exists and returns the adequate `ContentStrucure` to pass to the content writer.
215
215
216
+
## Use the NotModifiedContentFilter
217
+
218
+
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.
219
+
220
+
```php
221
+
// In your DataflowType
222
+
public function __construct(NotModifiedContentFilter $notModifiedContentFilter)
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.
237
+
238
+
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.
239
+
240
+
### Supported field types
241
+
- ezstring
242
+
- ezauthor
243
+
- ezboolean
244
+
- ezcountry
245
+
- ezdate
246
+
- ezdatetime
247
+
- ezemail
248
+
- ezfloat
249
+
- ezisbn
250
+
- ezobjectrelation
251
+
- ezobjectrelationlist
252
+
- ezkeyword
253
+
- ezselection
254
+
- eztext
255
+
- eztime
256
+
- eztags
257
+
- novaseometas
258
+
- ezurl
259
+
- ezmatrix
260
+
- ezgmaplocation
261
+
- ezrichtext
262
+
263
+
### Add custom field comparator
264
+
265
+
If you want to add support for a field type, simply create your own comparator.
266
+
267
+
```php
268
+
<?php
269
+
270
+
use CodeRhapsodie\EzDataflowBundle\Core\FieldComparator\AbstractFieldComparator;
271
+
use eZ\Publish\Core\FieldType\Value;
272
+
//[...]
273
+
274
+
class MyFieldComparator extends AbstractFieldComparator
275
+
{
276
+
//[...]
277
+
protected function compareValues(Value $currentValue, Value $newValue): bool
278
+
{
279
+
// Return true if values are identical, false if values are different.
0 commit comments