Skip to content

Commit

Permalink
Prepare 4.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
loicsapone committed Oct 18, 2023
1 parent 00bd996 commit 3dd863c
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
CHANGELOG
=========

4.1.0
-----

* add command to generate DTOs base on files
* add `CallbackProcessor`
* update `JsonReader` to use less memory

4.0.0
-----

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $dataImporter->execute();

Additionally, this package provides deeper integration into Symfony:

* [An abstract command to easily setup import jobs in your projects](/docs/command.md)
* [An abstract command to easily setup import jobs in your projects](/docs/abstract_command.md)

## Issues and feature requests

Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions docs/processor.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,18 @@ class ArticleProcessor implements BatchProcessorInterface
}
}
```

## Callback processor

This is a processor that doesn't require creating a separate class. It is
useful whenever you need to perform a simple action, as demonstrated here:

```php
use IQ2i\DataImporter\Processor\CallbackProcessor;

$processor = new CallbackProcessor(
item: function (Message $message) {
// Do some stuff here
},
);
```
40 changes: 40 additions & 0 deletions docs/reader.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,46 @@ use IQ2i\DataImporter\Reader\JsonReader;
$jsonReader = new JsonReader('/path/to/your/json/file');
```

Just like the XmlReader, the JsonReader allows you to specify a node you
want to iterate over. Let's consider the following JSON file:

```json
{
"author": {
"firstname": "Kim",
"lastname": "Ralls",
"books": [
{
"title": "XML Developer's Guide",
"genre": "Computer",
"price": 44.95,
"description": "An in-depth look at creating applications with XML."
},
{
"title": "Midnight Rain",
"genre": "Fantasy",
"price": 5.95,
"description": "A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world."
}
]
}
}
```

To iterate over the "books" node, you simply need to specify a pointer:

```php
<?php

use IQ2i\DataImporter\Reader\JsonReader;

$xmlReader = new JsonReader(
'/path/to/your/json/file',
null,
[JsonReader::POINTER => '/author/books']
);
```

## Create your own reader

It is possible to create your own reader by implementing
Expand Down

0 comments on commit 3dd863c

Please sign in to comment.