diff --git a/src/batch-doctrine-dbal/docs/job-execution-storage.md b/docs/batch-doctrine-dbal/job-execution-storage.md similarity index 100% rename from src/batch-doctrine-dbal/docs/job-execution-storage.md rename to docs/batch-doctrine-dbal/job-execution-storage.md diff --git a/src/batch-doctrine-orm/docs/entity-item-reader.md b/docs/batch-doctrine-orm/entity-item-reader.md similarity index 100% rename from src/batch-doctrine-orm/docs/entity-item-reader.md rename to docs/batch-doctrine-orm/entity-item-reader.md diff --git a/src/batch-doctrine-persistence/docs/object-item-writer.md b/docs/batch-doctrine-persistence/object-item-writer.md similarity index 100% rename from src/batch-doctrine-persistence/docs/object-item-writer.md rename to docs/batch-doctrine-persistence/object-item-writer.md diff --git a/src/batch-doctrine-persistence/docs/object-registry.md b/docs/batch-doctrine-persistence/object-registry.md similarity index 96% rename from src/batch-doctrine-persistence/docs/object-registry.md rename to docs/batch-doctrine-persistence/object-registry.md index f0877250..c4cb0ecb 100644 --- a/src/batch-doctrine-persistence/docs/object-registry.md +++ b/docs/batch-doctrine-persistence/object-registry.md @@ -78,4 +78,4 @@ Otherwise, the query will be the fastest possible because it will use the object ## On the same subject -- [What is an item job ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/item-job.md) +- [What is an item job ?](../batch/domain/item-job.md) diff --git a/src/batch-league-flysystem/docs/copy-files-job.md b/docs/batch-league-flysystem/copy-files-job.md similarity index 100% rename from src/batch-league-flysystem/docs/copy-files-job.md rename to docs/batch-league-flysystem/copy-files-job.md diff --git a/src/batch-league-flysystem/docs/move-files-job.md b/docs/batch-league-flysystem/move-files-job.md similarity index 100% rename from src/batch-league-flysystem/docs/move-files-job.md rename to docs/batch-league-flysystem/move-files-job.md diff --git a/src/batch-openspout/docs/flat-file-item-reader.md b/docs/batch-openspout/flat-file-item-reader.md similarity index 88% rename from src/batch-openspout/docs/flat-file-item-reader.md rename to docs/batch-openspout/flat-file-item-reader.md index ed16ebe4..bc353c9c 100644 --- a/src/batch-openspout/docs/flat-file-item-reader.md +++ b/docs/batch-openspout/flat-file-item-reader.md @@ -1,6 +1,6 @@ # Item reader with CSV/ODS/XLSX files -The [FlatFileReader](../src/Reader/FlatFileReader.php) is a reader +The [FlatFileReader](../../src/batch-openspout/src/Reader/FlatFileReader.php) is a reader that will read from CSV/ODS/XLSX file and return each line as an array. ```php @@ -45,4 +45,4 @@ new FlatFileReader( ## On the same subject -- [What is an item reader ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/item-job/item-reader.md) +- [What is an item reader ?](../batch/domain/item-job/item-reader.md) diff --git a/src/batch-openspout/docs/flat-file-item-writer.md b/docs/batch-openspout/flat-file-item-writer.md similarity index 86% rename from src/batch-openspout/docs/flat-file-item-writer.md rename to docs/batch-openspout/flat-file-item-writer.md index 92d057ce..80f03925 100644 --- a/src/batch-openspout/docs/flat-file-item-writer.md +++ b/docs/batch-openspout/flat-file-item-writer.md @@ -1,6 +1,6 @@ # Item writer with CSV/ODS/XLSX files -The [FlatFileWriter](../src/Writer/FlatFileWriter.php) is a writer that will write to CSV/ODS/XLSX file and each item will +The [FlatFileWriter](../../src/batch-openspout/src/Writer/FlatFileWriter.php) is a writer that will write to CSV/ODS/XLSX file and each item will written its own line. ```php @@ -47,4 +47,4 @@ new FlatFileWriter( ## On the same subject -- [What is an item writer ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/item-job/item-writer.md) +- [What is an item writer ?](../batch/domain/item-job/item-writer.md) diff --git a/src/batch-symfony-console/docs/command.md b/docs/batch-symfony-console/command.md similarity index 69% rename from src/batch-symfony-console/docs/command.md rename to docs/batch-symfony-console/command.md index 24e6de7c..369f0988 100644 --- a/src/batch-symfony-console/docs/command.md +++ b/docs/batch-symfony-console/command.md @@ -1,6 +1,6 @@ # Command -The [RunJobCommand](../src/RunJobCommand.php) can execute any job. +The [RunJobCommand](../../src/batch-symfony-console/src/RunJobCommand.php) can execute any job. The command accepts 2 arguments : - the job name to execute diff --git a/src/batch-symfony-console/docs/job-launcher.md b/docs/batch-symfony-console/job-launcher.md similarity index 53% rename from src/batch-symfony-console/docs/job-launcher.md rename to docs/batch-symfony-console/job-launcher.md index ab27ce85..7dcebaf7 100644 --- a/src/batch-symfony-console/docs/job-launcher.md +++ b/docs/batch-symfony-console/job-launcher.md @@ -1,6 +1,6 @@ # Job launcher -The [RunCommandJobLauncher](../src/RunCommandJobLauncher.php) execute jobs via an asynchronous symfony command. +The [RunCommandJobLauncher](../../src/batch-symfony-console/src/RunCommandJobLauncher.php) execute jobs via an asynchronous symfony command. The command called is [`yokai:batch:run`](command.md), and the command will actually execute the job. @@ -9,4 +9,4 @@ Additionally, the command will run with an output redirect (`>>`) to `var/log/ba ## On the same subject -- [What is a job launcher ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job-launcher.md) +- [What is a job launcher ?](../batch/domain/job-launcher.md) diff --git a/src/batch-symfony-framework/docs/getting-started.md b/docs/batch-symfony-framework/getting-started.md similarity index 84% rename from src/batch-symfony-framework/docs/getting-started.md rename to docs/batch-symfony-framework/getting-started.md index 60f625e1..c411d446 100644 --- a/src/batch-symfony-framework/docs/getting-started.md +++ b/docs/batch-symfony-framework/getting-started.md @@ -24,7 +24,7 @@ yokai_batch: async: ... ``` -> **note**: if you do not configure anything here, you will be using the [`SimpleJobLauncher`](https://github.com/yokai-php/batch/blob/0.x/src/Launcher/SimpleJobLauncher.php). +> **note**: if you do not configure anything here, you will be using the [`SimpleJobLauncher`](../../src/batch/src/Launcher/SimpleJobLauncher.php). The `default` job launcher, must reference a launcher name, defined in the `launchers` list. The `default` job launcher will be the autowired instance of job launcher when you ask for one. @@ -48,9 +48,9 @@ final class YourAppCode ``` All `launchers` are configured using a DSN, every scheme has it's own associated factory. -- `simple://simple`: a [`SimpleJobLauncher`](https://github.com/yokai-php/batch/blob/0.x/src/Launcher/SimpleJobLauncher.php), no configuration allowed -- `messenger://messenger`: a [`DispatchMessageJobLauncher`](https://github.com/yokai-php/batch-symfony-messenger/blob/0.x/src/DispatchMessageJobLauncher.php), no configuration allowed -- `console://console`: a [`RunCommandJobLauncher`](https://github.com/yokai-php/batch-symfony-console/blob/0.x/src/RunCommandJobLauncher.php), configurable options: +- `simple://simple`: a [`SimpleJobLauncher`](../../src/batch/src/Launcher/SimpleJobLauncher.php), no configuration allowed +- `messenger://messenger`: a [`DispatchMessageJobLauncher`](../../src/batch-symfony-messenger/src/DispatchMessageJobLauncher.php), no configuration allowed +- `console://console`: a [`RunCommandJobLauncher`](../../src/batch-symfony-console/src/RunCommandJobLauncher.php), configurable options: - `log`: the filename where command output will be redirected (defaults to `batch_execute.log`) - `service://service`: pointing to a service of your choice, configurable options: - `service`: the id of the service to use (required, an exception will be thrown otherwise) @@ -122,7 +122,7 @@ final class NameOfYourJob implements JobInterface, JobWithStaticNameInterface ``` > **note**: when registering jobs with dedicated class, you can use the -> [JobWithStaticNameInterface](../src/JobWithStaticNameInterface.php) interface +> [JobWithStaticNameInterface](../../src/batch-symfony-framework/src/JobWithStaticNameInterface.php) interface > to be able to specify the job name of your service. > Otherwise, the service id will be used, and in that case, the service id is the FQCN. @@ -183,6 +183,6 @@ final readonly class YourService ## On the same subject -- [What is a job execution storage ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job-execution-storage.md) -- [What is a job ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job.md) -- [What is a job launcher ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job-launcher.md) +- [What is a job execution storage ?](../batch/domain/job-execution-storage.md) +- [What is a job ?](../batch/domain/job.md) +- [What is a job launcher ?](../batch/domain/job-launcher.md) diff --git a/src/batch-symfony-framework/docs/images/bootstrap4-children.png b/docs/batch-symfony-framework/images/bootstrap4-children.png similarity index 100% rename from src/batch-symfony-framework/docs/images/bootstrap4-children.png rename to docs/batch-symfony-framework/images/bootstrap4-children.png diff --git a/src/batch-symfony-framework/docs/images/bootstrap4-details.png b/docs/batch-symfony-framework/images/bootstrap4-details.png similarity index 100% rename from src/batch-symfony-framework/docs/images/bootstrap4-details.png rename to docs/batch-symfony-framework/images/bootstrap4-details.png diff --git a/src/batch-symfony-framework/docs/images/bootstrap4-list.png b/docs/batch-symfony-framework/images/bootstrap4-list.png similarity index 100% rename from src/batch-symfony-framework/docs/images/bootstrap4-list.png rename to docs/batch-symfony-framework/images/bootstrap4-list.png diff --git a/src/batch-symfony-framework/docs/images/bootstrap4-warnings.png b/docs/batch-symfony-framework/images/bootstrap4-warnings.png similarity index 100% rename from src/batch-symfony-framework/docs/images/bootstrap4-warnings.png rename to docs/batch-symfony-framework/images/bootstrap4-warnings.png diff --git a/src/batch-symfony-framework/docs/images/sonata-children.png b/docs/batch-symfony-framework/images/sonata-children.png similarity index 100% rename from src/batch-symfony-framework/docs/images/sonata-children.png rename to docs/batch-symfony-framework/images/sonata-children.png diff --git a/src/batch-symfony-framework/docs/images/sonata-details.png b/docs/batch-symfony-framework/images/sonata-details.png similarity index 100% rename from src/batch-symfony-framework/docs/images/sonata-details.png rename to docs/batch-symfony-framework/images/sonata-details.png diff --git a/src/batch-symfony-framework/docs/images/sonata-list.png b/docs/batch-symfony-framework/images/sonata-list.png similarity index 100% rename from src/batch-symfony-framework/docs/images/sonata-list.png rename to docs/batch-symfony-framework/images/sonata-list.png diff --git a/src/batch-symfony-framework/docs/images/sonata-warnings.png b/docs/batch-symfony-framework/images/sonata-warnings.png similarity index 100% rename from src/batch-symfony-framework/docs/images/sonata-warnings.png rename to docs/batch-symfony-framework/images/sonata-warnings.png diff --git a/src/batch-symfony-framework/docs/ui.md b/docs/batch-symfony-framework/ui.md similarity index 93% rename from src/batch-symfony-framework/docs/ui.md rename to docs/batch-symfony-framework/ui.md index 47cd3d35..dca146a2 100644 --- a/src/batch-symfony-framework/docs/ui.md +++ b/docs/batch-symfony-framework/ui.md @@ -32,7 +32,7 @@ _yokai_batch: ### Templating -The templating service is used by the [JobController](../src/UserInterface/Controller/JobController.php) to render its templates. +The templating service is used by the [JobController](../../src/batch-symfony-framework/src/UserInterface/Controller/JobController.php) to render its templates. It's a wrapper around [Twig](https://twig.symfony.com/), for you to control templates used, and variables passed. > By default @@ -191,6 +191,6 @@ But you can also register job name dedicated templates if you need some specific ## On the same subject -- [What is a job execution storage ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job-execution-storage.md) -- [What is a job ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job.md) -- [What is a job launcher ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job-launcher.md) +- [What is a job execution storage ?](../batch/domain/job-execution-storage.md) +- [What is a job ?](../batch/domain/job.md) +- [What is a job launcher ?](../batch/domain/job-launcher.md) diff --git a/src/batch-symfony-messenger/docs/dispatch-each-item-writer.md b/docs/batch-symfony-messenger/dispatch-each-item-writer.md similarity index 100% rename from src/batch-symfony-messenger/docs/dispatch-each-item-writer.md rename to docs/batch-symfony-messenger/dispatch-each-item-writer.md diff --git a/src/batch-symfony-messenger/docs/job-launcher.md b/docs/batch-symfony-messenger/job-launcher.md similarity index 67% rename from src/batch-symfony-messenger/docs/job-launcher.md rename to docs/batch-symfony-messenger/job-launcher.md index a2fab2f8..b7e09a01 100644 --- a/src/batch-symfony-messenger/docs/job-launcher.md +++ b/docs/batch-symfony-messenger/job-launcher.md @@ -1,10 +1,10 @@ # Job launcher -The [DispatchMessageJobLauncher](../src/DispatchMessageJobLauncher.php) execute +The [DispatchMessageJobLauncher](../../src/batch-symfony-messenger/src/DispatchMessageJobLauncher.php) execute jobs via a symfony command message dispatch. -A [LaunchJobMessage](../src/LaunchJobMessage.php) message will be dispatched -and handled by the [LaunchJobMessageHandler](../src/LaunchJobMessageHandler.php) +A [LaunchJobMessage](../../src/batch-symfony-messenger/src/LaunchJobMessage.php) message will be dispatched +and handled by the [LaunchJobMessageHandler](../../src/batch-symfony-messenger/src/LaunchJobMessageHandler.php) will be called with that message after being routed. ## How to configure an async transport for the launcher ? @@ -29,4 +29,4 @@ framework: ## On the same subject -- [What is a job launcher ?](https://github.com/yokai-php/batch/blob/0.x/docs/domain/job-launcher.md) +- [What is a job launcher ?](../batch/domain/job-launcher.md) diff --git a/src/batch-symfony-serializer/docs/denormalize-item-processor.md b/docs/batch-symfony-serializer/denormalize-item-processor.md similarity index 100% rename from src/batch-symfony-serializer/docs/denormalize-item-processor.md rename to docs/batch-symfony-serializer/denormalize-item-processor.md diff --git a/src/batch-symfony-serializer/docs/job-execution-serializer.md b/docs/batch-symfony-serializer/job-execution-serializer.md similarity index 100% rename from src/batch-symfony-serializer/docs/job-execution-serializer.md rename to docs/batch-symfony-serializer/job-execution-serializer.md diff --git a/src/batch-symfony-serializer/docs/normalize-item-processor.md b/docs/batch-symfony-serializer/normalize-item-processor.md similarity index 100% rename from src/batch-symfony-serializer/docs/normalize-item-processor.md rename to docs/batch-symfony-serializer/normalize-item-processor.md diff --git a/src/batch-symfony-validator/docs/skip-invalid-item-processor.md b/docs/batch-symfony-validator/skip-invalid-item-processor.md similarity index 100% rename from src/batch-symfony-validator/docs/skip-invalid-item-processor.md rename to docs/batch-symfony-validator/skip-invalid-item-processor.md diff --git a/src/batch/docs/domain/item-job.md b/docs/batch/domain/item-job.md similarity index 100% rename from src/batch/docs/domain/item-job.md rename to docs/batch/domain/item-job.md diff --git a/docs/batch/domain/item-job/item-processor.md b/docs/batch/domain/item-job/item-processor.md new file mode 100644 index 00000000..0b3b3f91 --- /dev/null +++ b/docs/batch/domain/item-job/item-processor.md @@ -0,0 +1,37 @@ +# What is an item processor ? + +The item processor is used by the item job to transform every read item. + +It can be any class implementing [ItemProcessorInterface](../../../../src/batch/src/Job/Item/ItemProcessorInterface.php). + +## What types of item processors exists ? + +**Built-in item processors:** +- [ArrayMapProcessor](../../../../src/batch/src/Job/Item/Processor/ArrayMapProcessor.php): + apply a callback to each element of array items. +- [CallbackProcessor](../../../../src/batch/src/Job/Item/Processor/CallbackProcessor.php): + use a callback to transform each items. +- [ChainProcessor](../../../../src/batch/src/Job/Item/Processor/ChainProcessor.php): + chain transformation of multiple item processor, one after the other. +- [FilterUniqueProcessor](../../../../src/batch/src/Job/Item/Processor/FilterUniqueProcessor.php): + assign an identifier to each item, and skip already encountered items. +- [NullProcessor](../../../../src/batch/src/Job/Item/Processor/NullProcessor.php): + perform no transformation on items. +- [RoutingProcessor](../../../../src/batch/src/Job/Item/Processor/RoutingProcessor.php): + route processing to different processor based on your logic. + +**Item processors from bridges:** +- [SkipInvalidItemProcessor (`symfony/validator`)](../../../../src/batch-symfony-validator/src/SkipInvalidItemProcessor.php): + validate item and throw exception if invalid that will cause item to be skipped. +- [DenormalizeItemProcessor (`symfony/serializer`)](../../../../src/batch-symfony-serializer/src/DenormalizeItemProcessor.php): + denormalize each item. +- [NormalizeItemProcessor (`symfony/serializer`)](../../../../src/batch-symfony-serializer/src/NormalizeItemProcessor.php): + normalize each item. + +**Item processors for testing purpose:** +- [TestDebugProcessor](../../../../src/batch/src/Test/Job/Item/Processor/TestDebugProcessor.php): + dummy item processor that you can use in your unit tests. + +## On the same subject + +- [What is an item job ?](../item-job.md) diff --git a/docs/batch/domain/item-job/item-reader.md b/docs/batch/domain/item-job/item-reader.md new file mode 100644 index 00000000..506cad3a --- /dev/null +++ b/docs/batch/domain/item-job/item-reader.md @@ -0,0 +1,43 @@ +# What is an item reader ? + +The item reader is used by the item job to extract item from a source. + +It can be any class implementing [ItemReaderInterface](../../../../src/batch/src/Job/Item/ItemReaderInterface.php). + +## What types of item readers exists ? + +**Built-in item readers:** +- [FixedColumnSizeFileReader](../../../../src/batch/src/Job/Item/Reader/Filesystem/FixedColumnSizeFileReader.php): + read a file line by line, and decode each line with fixed columns size to an array. +- [JsonLinesReader](../../../../src/batch/src/Job/Item/Reader/Filesystem/JsonLinesReader.php): + read a file line by line, and decode each line as JSON. +- [AddMetadataReader](../../../../src/batch/src/Job/Item/Reader/AddMetadataReader.php): + decorates another reader by adding static information to each read item. +- [IndexWithReader](../../../../src/batch/src/Job/Item/Reader/IndexWithReader.php): + decorates another reader by changing index of each item. +- [ParameterAccessorReader](../../../../src/batch/src/Job/Item/Reader/ParameterAccessorReader.php): + read from an inmemory value located at some configurable place. +- [SequenceReader](../../../../src/batch/src/Job/Item/Reader/SequenceReader.php): + read from multiple item reader, one after the other. +- [StaticIterableReader](../../../../src/batch/src/Job/Item/Reader/StaticIterableReader.php): + read from an iterable you provide during construction. +- [CallbackReader](../../../../src/batch/src/Job/Item/Reader/CallbackReader.php): + read from a `Closure` you provide during construction. + +**Item readers from bridges:** +- [FlatFileReader (`openspout/openspout`)](../../../../src/batch-openspout/src/Reader/FlatFileReader.php): + read from any CSV/ODS/XLSX file. +- [DoctrineDBALQueryOffsetReader (`doctrine/dbal`)](../../../../src/batch-doctrine-dbal/src/DoctrineDBALQueryOffsetReader.php): + read execute an SQL query and iterate over results, using a limit + offset pagination strategy. +- [DoctrineDBALQueryCursorReader (`doctrine/dbal`)](../../../../src/batch-doctrine-dbal/src/DoctrineDBALQueryCursorReader.php): + read execute an SQL query and iterate over results, using a column based cursor strategy. +- [EntityReader (`doctrine/orm`)](../../../../src/batch-doctrine-orm/src/EntityReader.php): + read from any Doctrine ORM entity. + +**Item readers for testing purpose:** +- [TestDebugReader](../../../../src/batch/src/Test/Job/Item/Reader/TestDebugReader.php): + dummy item reader that you can use in your unit tests. + +## On the same subject + +- [What is an item job ?](../item-job.md) diff --git a/docs/batch/domain/item-job/item-writer.md b/docs/batch/domain/item-job/item-writer.md new file mode 100644 index 00000000..48e68b47 --- /dev/null +++ b/docs/batch/domain/item-job/item-writer.md @@ -0,0 +1,53 @@ +# What is an item writer ? + +The item writer is used by the item job to load every processed item. + +It can be any class implementing [ItemWriterInterface](../../../../src/batch/src/Job/Item/ItemWriterInterface.php). + +## What types of item writers exists ? + +**Built-in item writers:** +- [JsonLinesWriter](../../../../src/batch/src/Job/Item/Writer/Filesystem/JsonLinesWriter.php): + write items as a json string each on a line of a file. +- [ChainWriter](../../../../src/batch/src/Job/Item/Writer/ChainWriter.php): + write items on multiple item writers. +- [ConditionalWriter](../../../../src/batch/src/Job/Item/Writer/ConditionalWriter.php): + will only write items that are matching your conditions. +- [DispatchEventsWriter](../../../../src/batch/src/Job/Item/Writer/DispatchEventsWriter.php): + will dispatch events before and after writing. +- [LaunchJobForEachItemWriter](../../../../src/batch/src/Job/Item/Writer/LaunchJobForEachItemWriter.php): + launch another job for each items. +- [LaunchJobForItemsBatchWriter](../../../../src/batch/src/Job/Item/Writer/LaunchJobForItemsBatchWriter.php): + launch another job for each item batches. +- [NullWriter](../../../../src/batch/src/Job/Item/Writer/NullWriter.php): + do not write items. +- [RoutingWriter](../../../../src/batch/src/Job/Item/Writer/RoutingWriter.php): + route writing to different writer based on your logic. +- [SummaryWriter](../../../../src/batch/src/Job/Item/Writer/SummaryWriter.php): + write items to a job summary value. +- [TransformingWriter](../../../../src/batch/src/Job/Item/Writer/TransformingWriter.php): + perform items transformation before delegating to another writer. +- [CallbackWriter](../../../../src/batch/src/Job/Item/Writer/CallbackWriter.php): + delegate items write operations to a closure passed at construction. + +**Item writers from bridges:** +- [DispatchEachItemAsMessageWriter (`symfony/messenger`)](../../../../src/batch-symfony-messenger/src/Writer/DispatchEachItemAsMessageWriter.php): + dispatch each item as a message in a bus. +- [DoctrineDBALInsertWriter (`doctrine/dbal`)](../../../../src/batch-doctrine-dbal/src/DoctrineDBALInsertWriter.php): + write items by inserting in a table via a Doctrine `Connection`. +- [DoctrineDBALUpsertWriter (`doctrine/dbal`)](../../../../src/batch-doctrine-dbal/src/DoctrineDBALUpsertWriter.php): + write items by inserting/updating in a table via a Doctrine `Connection`. +- [ObjectWriter (`doctrine/persistence`)](../../../../src/batch-doctrine-persistence/src/ObjectWriter.php): + write items to any Doctrine `ObjectManager`. +- [FlatFileWriter (`openspout/openspout`)](../../../../src/batch-openspout/src/Writer/FlatFileWriter.php): + write items to any CSV/ODS/XLSX file. + +**Item writers for testing purpose:** +- [InMemoryWriter](../../../../src/batch/src/Test/Job/Item/Writer/InMemoryWriter.php): + write in a private var which can be accessed afterward in your tests. +- [TestDebugWriter](../../../../src/batch/src/Test/Job/Item/Writer/TestDebugWriter.php): + dummy item writer that you can use in your unit tests. + +## On the same subject + +- [What is an item job ?](../item-job.md) diff --git a/src/batch/docs/domain/job-execution-storage.md b/docs/batch/domain/job-execution-storage.md similarity index 67% rename from src/batch/docs/domain/job-execution-storage.md rename to docs/batch/domain/job-execution-storage.md index b089837b..a8471c93 100644 --- a/src/batch/docs/domain/job-execution-storage.md +++ b/docs/batch/domain/job-execution-storage.md @@ -18,15 +18,15 @@ This is [JobLauncher](job-launcher.md)'s job to store it whenever it is required ## How can I retrieve a Job Execution afterwards ? -Every storage implements [JobExecutionStorageInterface](../../src/Storage/JobExecutionStorageInterface.php) +Every storage implements [JobExecutionStorageInterface](../../../src/batch/src/Storage/JobExecutionStorageInterface.php) that has a method called `retrieve`. Use this method to retrieve one execution using job name and execution id. - +../../../src/batch/src/ Depending on which storage you decided to use, you may also be able to: - list of all executions for particular job, if your storage implements - [ListableJobExecutionStorageInterface](../../src/Storage/ListableJobExecutionStorageInterface.php): + [ListableJobExecutionStorageInterface](../../../src/batch/src/Storage/ListableJobExecutionStorageInterface.php): - filter list of executions matching criteria you provided, if your storage implements - [QueryableJobExecutionStorageInterface](../../src/Storage/QueryableJobExecutionStorageInterface.php): + [QueryableJobExecutionStorageInterface](../../../src/batch/src/Storage/QueryableJobExecutionStorageInterface.php): > **Note:** Sometimes the storage may implement these interfaces, but > due to the way executions are stored, it might not be recommended heavily rely on these extra methods. @@ -34,17 +34,17 @@ Depending on which storage you decided to use, you may also be able to: ## What types of storages exists ? **Built-in storages:** -- [NullJobExecutionStorage](../../src/Storage/NullJobExecutionStorage.php): +- [NullJobExecutionStorage](../../../src/batch/src/Storage/NullJobExecutionStorage.php): do not persist any job execution. -- [FilesystemJobExecutionStorage](../../src/Storage/FilesystemJobExecutionStorage.php): +- [FilesystemJobExecutionStorage](../../../src/batch/src/Storage/FilesystemJobExecutionStorage.php): store job executions to a file on local filesystem. **Storages from bridges:** -- [DoctrineDBALJobExecutionStorage (`doctrine/dbal`)](https://github.com/yokai-php/batch-doctrine-dbal/blob/0.x/src/DoctrineDBALJobExecutionStorage.php): +- [DoctrineDBALJobExecutionStorage (`doctrine/dbal`)](../../../src/batch-doctrine-dbal/src/DoctrineDBALJobExecutionStorage.php): store job executions to a relational database. **Storages for testing purpose:** -- [InMemoryJobExecutionStorage](../../src/Test/Storage/InMemoryJobExecutionStorage.php): +- [InMemoryJobExecutionStorage](../../../src/batch/src/Test/Storage/InMemoryJobExecutionStorage.php): store executions in a private var that can be accessed afterwards in your tests. ## On the same subject diff --git a/src/batch/docs/domain/job-execution.md b/docs/batch/domain/job-execution.md similarity index 87% rename from src/batch/docs/domain/job-execution.md rename to docs/batch/domain/job-execution.md index cee1f8ef..ed007ddd 100644 --- a/src/batch/docs/domain/job-execution.md +++ b/docs/batch/domain/job-execution.md @@ -2,7 +2,7 @@ ## What is a Job execution ? -A [JobExecution](../../src/JobExecution.php) is the class that holds information about one execution of a [job](job.md). +A [JobExecution](../../../src/batch/src/JobExecution.php) is the class that holds information about one execution of a [job](job.md). ## What kind of information does it hold ? diff --git a/src/batch/docs/domain/job-launcher.md b/docs/batch/domain/job-launcher.md similarity index 83% rename from src/batch/docs/domain/job-launcher.md rename to docs/batch/domain/job-launcher.md index 75315dc5..69007b3f 100644 --- a/src/batch/docs/domain/job-launcher.md +++ b/docs/batch/domain/job-launcher.md @@ -49,17 +49,17 @@ $execution = $launcher->launch('your.job.name', ['job' => ['configuration']]); ## What types of launcher exists ? **Built-in launchers:** -- [SimpleJobLauncher](../../src/Launcher/SimpleJobLauncher.php): +- [SimpleJobLauncher](../../../src/batch/src/Launcher/SimpleJobLauncher.php): execute the job directly in the same PHP process. **Launchers from bridges:** -- [RunCommandJobLauncher (`symfony/console`)](https://github.com/yokai-php/batch-symfony-console/blob/0.x/src/RunCommandJobLauncher.php): +- [RunCommandJobLauncher (`symfony/console`)](../../../src/batch-symfony-console/src/RunCommandJobLauncher.php): execute the job via an asynchronous symfony command. -- [DispatchMessageJobLauncher (`symfony/messenger`)](https://github.com/yokai-php/batch-symfony-messenger/blob/0.x/src/DispatchMessageJobLauncher.php): +- [DispatchMessageJobLauncher (`symfony/messenger`)](../../../src/batch-symfony-messenger/src/DispatchMessageJobLauncher.php): execute the job via a symfony message dispatch. **Launchers for testing purpose:** -- [BufferingJobLauncher](../../src/Test/Launcher/BufferingJobLauncher.php): +- [BufferingJobLauncher](../../../src/batch/src/Test/Launcher/BufferingJobLauncher.php): do not execute job, but store execution in a private var that can be accessed afterwards in your tests. ## On the same subject diff --git a/src/batch/docs/domain/job-parameter-accessor.md b/docs/batch/domain/job-parameter-accessor.md similarity index 51% rename from src/batch/docs/domain/job-parameter-accessor.md rename to docs/batch/domain/job-parameter-accessor.md index 3425f9b7..ce9ffe57 100644 --- a/src/batch/docs/domain/job-parameter-accessor.md +++ b/docs/batch/domain/job-parameter-accessor.md @@ -1,7 +1,7 @@ # Job parameter accessor When a job (or a component within a job) can be working with a parameterized value, -it can rely on a [JobParameterAccessorInterface](../../src/Job/Parameters/JobParameterAccessorInterface.php) +it can rely on a [JobParameterAccessorInterface](../../../src/batch/src/Job/Parameters/JobParameterAccessorInterface.php) instance to retrieve that value. ```php @@ -31,29 +31,29 @@ class FooJob implements JobInterface ## What types of parameter accessors exists ? **Built-in parameter accessors:** -- [ChainParameterAccessor.php](../../src/Job/Parameters/ChainParameterAccessor.php): +- [ChainParameterAccessor.php](../../../src/batch/src/Job/Parameters/ChainParameterAccessor.php): try multiple parameter accessors, the first that is not failing is used. -- [ClosestJobExecutionAccessor](../../src/Job/Parameters/ClosestJobExecutionAccessor.php): +- [ClosestJobExecutionAccessor](../../../src/batch/src/Job/Parameters/ClosestJobExecutionAccessor.php): try another parameter accessor on each job execution in hierarchy, until not failed. -- [DefaultParameterAccessor](../../src/Job/Parameters/DefaultParameterAccessor.php): +- [DefaultParameterAccessor](../../../src/batch/src/Job/Parameters/DefaultParameterAccessor.php): try accessing parameter using another parameter accessor, use default value if failed. -- [JobExecutionParameterAccessor](../../src/Job/Parameters/JobExecutionParameterAccessor.php): - extract value from job execution's [parameters](../../src/JobParameters.php). -- [JobExecutionSummaryAccessor](../../src/Job/Parameters/JobExecutionSummaryAccessor.php): - extract value from job execution's [summary](../../src/Summary.php). -- [ParentJobExecutionAccessor](../../src/Job/Parameters/ParentJobExecutionAccessor.php): +- [JobExecutionParameterAccessor](../../../src/batch/src/Job/Parameters/JobExecutionParameterAccessor.php): + extract value from job execution's [parameters](../../../src/batch/src/JobParameters.php). +- [JobExecutionSummaryAccessor](../../../src/batch/src/Job/Parameters/JobExecutionSummaryAccessor.php): + extract value from job execution's [summary](../../../src/batch/src/Summary.php). +- [ParentJobExecutionAccessor](../../../src/batch/src/Job/Parameters/ParentJobExecutionAccessor.php): use another parameter accessor on job execution's parent execution. -- [ReplaceWithVariablesParameterAccessor](../../src/Job/Parameters/ReplaceWithVariablesParameterAccessor.php): +- [ReplaceWithVariablesParameterAccessor](../../../src/batch/src/Job/Parameters/ReplaceWithVariablesParameterAccessor.php): use another parameter accessor to get string value, and replace variables before returning. -- [RootJobExecutionAccessor](../../src/Job/Parameters/RootJobExecutionAccessor.php): +- [RootJobExecutionAccessor](../../../src/batch/src/Job/Parameters/RootJobExecutionAccessor.php): use another parameter accessor on job execution's root execution. -- [SiblingJobExecutionAccessor](../../src/Job/Parameters/SiblingJobExecutionAccessor.php): +- [SiblingJobExecutionAccessor](../../../src/batch/src/Job/Parameters/SiblingJobExecutionAccessor.php): use another parameter accessor on job execution's sibling execution. -- [StaticValueParameterAccessor](../../src/Job/Parameters/StaticValueParameterAccessor.php): +- [StaticValueParameterAccessor](../../../src/batch/src/Job/Parameters/StaticValueParameterAccessor.php): use static value provided at construction. **Parameter accessors from bridges:** -- [ContainerParameterAccessor (`symfony/framework-bundle`)](https://github.com/yokai-php/batch-symfony-framework/blob/0.x/src/ContainerParameterAccessor.php): +- [ContainerParameterAccessor (`symfony/framework-bundle`)](../../../src/batch-symfony-framework/src/ContainerParameterAccessor.php): use a parameter from Symfony's container. ## On the same subject diff --git a/src/batch/docs/domain/job-with-children.md b/docs/batch/domain/job-with-children.md similarity index 100% rename from src/batch/docs/domain/job-with-children.md rename to docs/batch/domain/job-with-children.md diff --git a/src/batch/docs/domain/job.md b/docs/batch/domain/job.md similarity index 65% rename from src/batch/docs/domain/job.md rename to docs/batch/domain/job.md index eaef819b..66d1c44f 100644 --- a/src/batch/docs/domain/job.md +++ b/docs/batch/domain/job.md @@ -26,24 +26,24 @@ class DoStuffJob implements JobInterface } ``` -The only requirement is implementing [`JobInterface`](../../src/Job/JobInterface.php), +The only requirement is implementing [`JobInterface`](../../../src/batch/src/Job/JobInterface.php), ## What types of job exists ? **Built-in jobs:** -- [AbstractDecoratedJob](../../src/Job/AbstractDecoratedJob.php): +- [AbstractDecoratedJob](../../../src/batch/src/Job/AbstractDecoratedJob.php): a job that is designed to be extended, helps job construction. -- [ItemJob](../../src/Job/Item/ItemJob.php): +- [ItemJob](../../../src/batch/src/Job/Item/ItemJob.php): ETL like, batch processing job ([documentation](item-job.md)). -- [JobWithChildJobs](../../src/Job/JobWithChildJobs.php): +- [JobWithChildJobs](../../../src/batch/src/Job/JobWithChildJobs.php): a job that trigger other jobs ([documentation](job-with-children.md)). -- [TriggerScheduledJobsJob](../../src/Trigger/TriggerScheduledJobsJob.php): +- [TriggerScheduledJobsJob](../../../src/batch/src/Trigger/TriggerScheduledJobsJob.php): a job that trigger other jobs when schedule is due (todo documentation). **Jobs from bridges:** -- [CopyFilesJob (`league/flysystem`)](https://github.com/yokai-php/batch-league-flysystem/blob/0.x/src/Job/CopyFilesJob.php): +- [CopyFilesJob (`league/flysystem`)](../../../src/batch-league-flysystem/src/Job/CopyFilesJob.php): copy files from one filesystem to another. -- [MoveFilesJob (`league/flysystem`)](https://github.com/yokai-php/batch-league-flysystem/blob/0.x/src/Job/MoveFilesJob.php): +- [MoveFilesJob (`league/flysystem`)](../../../src/batch-league-flysystem/src/Job/MoveFilesJob.php): move files from one filesystem to another. ## On the same subject diff --git a/src/batch/docs/getting-started.md b/docs/batch/getting-started.md similarity index 100% rename from src/batch/docs/getting-started.md rename to docs/batch/getting-started.md diff --git a/src/batch/docs/recipes/aware-interfaces.md b/docs/batch/recipes/aware-interfaces.md similarity index 50% rename from src/batch/docs/recipes/aware-interfaces.md rename to docs/batch/recipes/aware-interfaces.md index 4edb3979..851a6e15 100644 --- a/src/batch/docs/recipes/aware-interfaces.md +++ b/docs/batch/recipes/aware-interfaces.md @@ -1,6 +1,6 @@ # *Aware interfaces -When a job execution starts, a [JobExecution](../../src/JobExecution.php) is created for it. +When a job execution starts, a [JobExecution](../../../src/batch/src/JobExecution.php) is created for it. This object contains information about the current execution. You will often want to access this object or one of its child to : @@ -11,26 +11,26 @@ To do that, your component will need to implement an interface, telling the libr ## What is `JobExecutionAwareInterface` ? -The [JobExecutionAwareInterface](../../src/Job/JobExecutionAwareInterface.php) -will allow you to gain access to the current [JobExecution](../../src/JobExecution.php). +The [JobExecutionAwareInterface](../../../src/batch/src/Job/JobExecutionAwareInterface.php) +will allow you to gain access to the current [JobExecution](../../../src/batch/src/JobExecution.php). -> **note:** this interface is covered by [JobExecutionAwareTrait](../../src/Job/JobExecutionAwareTrait.php) +> **note:** this interface is covered by [JobExecutionAwareTrait](../../../src/batch/src/Job/JobExecutionAwareTrait.php) > for a default implementation that is most of the time sufficient. ## What is `JobParametersAwareInterface` ? -The [JobParametersAwareInterface](../../src/Job/JobParametersAwareInterface.php) -will allow you to gain access to the [JobParameters](../../src/JobParameters.php) of the current execution. +The [JobParametersAwareInterface](../../../src/batch/src/Job/JobParametersAwareInterface.php) +will allow you to gain access to the [JobParameters](../../../src/batch/src/JobParameters.php) of the current execution. -> **note:** this interface is covered by [JobParametersAwareTrait](../../src/Job/JobParametersAwareTrait.php) +> **note:** this interface is covered by [JobParametersAwareTrait](../../../src/batch/src/Job/JobParametersAwareTrait.php) > for a default implementation that is most of the time sufficient. ## What is `SummaryAwareInterface` ? -The [SummaryAwareInterface](../../src/Job/SummaryAwareInterface.php) -will allow you to gain access to the [Summary](../../src/Summary.php) of the current execution. +The [SummaryAwareInterface](../../../src/batch/src/Job/SummaryAwareInterface.php) +will allow you to gain access to the [Summary](../../../src/batch/src/Summary.php) of the current execution. -> **note:** this interface is covered by [SummaryAwareTrait](../../src/Job/SummaryAwareTrait.php) +> **note:** this interface is covered by [SummaryAwareTrait](../../../src/batch/src/Job/SummaryAwareTrait.php) > for a default implementation that is most of the time sufficient. ## How does that work exactly ? @@ -39,14 +39,14 @@ There is no magic involved here, every component is responsible for propagating the context through these interfaces. In the library, you will find that : -- [ItemJob](../../src/Job/Item/ItemJob.php) is propagating context to - [ItemReaderInterface](../../src/Job/Item/ItemReaderInterface.php), - [ItemProcessorInterface](../../src/Job/Item/ItemProcessorInterface.php) and - [ItemWriterInterface](../../src/Job/Item/ItemWriterInterface.php).7 +- [ItemJob](../../../src/batch/src/Job/Item/ItemJob.php) is propagating context to + [ItemReaderInterface](../../../src/batch/src/Job/Item/ItemReaderInterface.php), + [ItemProcessorInterface](../../../src/batch/src/Job/Item/ItemProcessorInterface.php) and + [ItemWriterInterface](../../../src/batch/src/Job/Item/ItemWriterInterface.php).7 - Every - [ItemReaderInterface](../../src/Job/Item/ItemReaderInterface.php), - [ItemProcessorInterface](../../src/Job/Item/ItemProcessorInterface.php) and - [ItemWriterInterface](../../src/Job/Item/ItemWriterInterface.php) + [ItemReaderInterface](../../../src/batch/src/Job/Item/ItemReaderInterface.php), + [ItemProcessorInterface](../../../src/batch/src/Job/Item/ItemProcessorInterface.php) and + [ItemWriterInterface](../../../src/batch/src/Job/Item/ItemWriterInterface.php) acting as a decorator, is propagating context to their decorated element. You can add this interface to any class, but you are responsible for the context propagation. diff --git a/src/batch/docs/recipes/custom-job-execution-storage.md b/docs/batch/recipes/custom-job-execution-storage.md similarity index 100% rename from src/batch/docs/recipes/custom-job-execution-storage.md rename to docs/batch/recipes/custom-job-execution-storage.md diff --git a/src/batch/docs/domain/item-job/item-processor.md b/src/batch/docs/domain/item-job/item-processor.md deleted file mode 100644 index 833943de..00000000 --- a/src/batch/docs/domain/item-job/item-processor.md +++ /dev/null @@ -1,37 +0,0 @@ -# What is an item processor ? - -The item processor is used by the item job to transform every read item. - -It can be any class implementing [ItemProcessorInterface](../../../src/Job/Item/ItemProcessorInterface.php). - -## What types of item processors exists ? - -**Built-in item processors:** -- [ArrayMapProcessor](../../../src/Job/Item/Processor/ArrayMapProcessor.php): - apply a callback to each element of array items. -- [CallbackProcessor](../../../src/Job/Item/Processor/CallbackProcessor.php): - use a callback to transform each items. -- [ChainProcessor](../../../src/Job/Item/Processor/ChainProcessor.php): - chain transformation of multiple item processor, one after the other. -- [FilterUniqueProcessor](../../../src/Job/Item/Processor/FilterUniqueProcessor.php): - assign an identifier to each item, and skip already encountered items. -- [NullProcessor](../../../src/Job/Item/Processor/NullProcessor.php): - perform no transformation on items. -- [RoutingProcessor](../../../src/Job/Item/Processor/RoutingProcessor.php): - route processing to different processor based on your logic. - -**Item processors from bridges:** -- [SkipInvalidItemProcessor (`symfony/validator`)](https://github.com/yokai-php/batch-symfony-validator/blob/0.x/src/SkipInvalidItemProcessor.php): - validate item and throw exception if invalid that will cause item to be skipped. -- [DenormalizeItemProcessor (`symfony/serializer`)](https://github.com/yokai-php/batch-symfony-serializer/blob/0.x/src/DenormalizeItemProcessor.php): - denormalize each item. -- [NormalizeItemProcessor (`symfony/serializer`)](https://github.com/yokai-php/batch-symfony-serializer/blob/0.x/src/NormalizeItemProcessor.php): - normalize each item. - -**Item processors for testing purpose:** -- [TestDebugProcessor](../../../src/Test/Job/Item/Processor/TestDebugProcessor.php): - dummy item processor that you can use in your unit tests. - -## On the same subject - -- [What is an item job ?](../item-job.md) diff --git a/src/batch/docs/domain/item-job/item-reader.md b/src/batch/docs/domain/item-job/item-reader.md deleted file mode 100644 index 127971fc..00000000 --- a/src/batch/docs/domain/item-job/item-reader.md +++ /dev/null @@ -1,43 +0,0 @@ -# What is an item reader ? - -The item reader is used by the item job to extract item from a source. - -It can be any class implementing [ItemReaderInterface](../../../src/Job/Item/ItemReaderInterface.php). - -## What types of item readers exists ? - -**Built-in item readers:** -- [FixedColumnSizeFileReader](../../../src/Job/Item/Reader/Filesystem/FixedColumnSizeFileReader.php): - read a file line by line, and decode each line with fixed columns size to an array. -- [JsonLinesReader](../../../src/Job/Item/Reader/Filesystem/JsonLinesReader.php): - read a file line by line, and decode each line as JSON. -- [AddMetadataReader](../../../src/Job/Item/Reader/AddMetadataReader.php): - decorates another reader by adding static information to each read item. -- [IndexWithReader](../../../src/Job/Item/Reader/IndexWithReader.php): - decorates another reader by changing index of each item. -- [ParameterAccessorReader](../../../src/Job/Item/Reader/ParameterAccessorReader.php): - read from an inmemory value located at some configurable place. -- [SequenceReader](../../../src/Job/Item/Reader/SequenceReader.php): - read from multiple item reader, one after the other. -- [StaticIterableReader](../../../src/Job/Item/Reader/StaticIterableReader.php): - read from an iterable you provide during construction. -- [CallbackReader](../../../src/Job/Item/Reader/CallbackReader.php): - read from a `Closure` you provide during construction. - -**Item readers from bridges:** -- [FlatFileReader (`openspout/openspout`)](https://github.com/yokai-php/batch-openspout/blob/0.x/src/Reader/FlatFileReader.php): - read from any CSV/ODS/XLSX file. -- [DoctrineDBALQueryOffsetReader (`doctrine/dbal`)](https://github.com/yokai-php/batch-doctrine-dbal/blob/0.x/src/DoctrineDBALQueryOffsetReader.php): - read execute an SQL query and iterate over results, using a limit + offset pagination strategy. -- [DoctrineDBALQueryCursorReader (`doctrine/dbal`)](https://github.com/yokai-php/batch-doctrine-dbal/blob/0.x/src/DoctrineDBALQueryCursorReader.php): - read execute an SQL query and iterate over results, using a column based cursor strategy. -- [EntityReader (`doctrine/orm`)](https://github.com/yokai-php/batch-doctrine-orm/blob/0.x/src/EntityReader.php): - read from any Doctrine ORM entity. - -**Item readers for testing purpose:** -- [TestDebugReader](../../../src/Test/Job/Item/Reader/TestDebugReader.php): - dummy item reader that you can use in your unit tests. - -## On the same subject - -- [What is an item job ?](../item-job.md) diff --git a/src/batch/docs/domain/item-job/item-writer.md b/src/batch/docs/domain/item-job/item-writer.md deleted file mode 100644 index 67b74c01..00000000 --- a/src/batch/docs/domain/item-job/item-writer.md +++ /dev/null @@ -1,53 +0,0 @@ -# What is an item writer ? - -The item writer is used by the item job to load every processed item. - -It can be any class implementing [ItemWriterInterface](../../../src/Job/Item/ItemWriterInterface.php). - -## What types of item writers exists ? - -**Built-in item writers:** -- [JsonLinesWriter](../../../src/Job/Item/Writer/Filesystem/JsonLinesWriter.php): - write items as a json string each on a line of a file. -- [ChainWriter](../../../src/Job/Item/Writer/ChainWriter.php): - write items on multiple item writers. -- [ConditionalWriter](../../../src/Job/Item/Writer/ConditionalWriter.php): - will only write items that are matching your conditions. -- [DispatchEventsWriter](../../../src/Job/Item/Writer/DispatchEventsWriter.php): - will dispatch events before and after writing. -- [LaunchJobForEachItemWriter](../../../src/Job/Item/Writer/LaunchJobForEachItemWriter.php): - launch another job for each items. -- [LaunchJobForItemsBatchWriter](../../../src/Job/Item/Writer/LaunchJobForItemsBatchWriter.php): - launch another job for each item batches. -- [NullWriter](../../../src/Job/Item/Writer/NullWriter.php): - do not write items. -- [RoutingWriter](../../../src/Job/Item/Writer/RoutingWriter.php): - route writing to different writer based on your logic. -- [SummaryWriter](../../../src/Job/Item/Writer/SummaryWriter.php): - write items to a job summary value. -- [TransformingWriter](../../../src/Job/Item/Writer/TransformingWriter.php): - perform items transformation before delegating to another writer. -- [CallbackWriter](../../../src/Job/Item/Writer/CallbackWriter.php): - delegate items write operations to a closure passed at construction. - -**Item writers from bridges:** -- [DispatchEachItemAsMessageWriter (`symfony/messenger`)](https://github.com/yokai-php/batch-symfony-messenger/blob/0.x/src/Writer/DispatchEachItemAsMessageWriter.php): - dispatch each item as a message in a bus. -- [DoctrineDBALInsertWriter (`doctrine/dbal`)](https://github.com/yokai-php/batch-doctrine-dbal/blob/0.x/src/DoctrineDBALInsertWriter.php): - write items by inserting in a table via a Doctrine `Connection`. -- [DoctrineDBALUpsertWriter (`doctrine/dbal`)](https://github.com/yokai-php/batch-doctrine-dbal/blob/0.x/src/DoctrineDBALUpsertWriter.php): - write items by inserting/updating in a table via a Doctrine `Connection`. -- [ObjectWriter (`doctrine/persistence`)](https://github.com/yokai-php/batch-doctrine-persistence/blob/0.x/src/ObjectWriter.php): - write items to any Doctrine `ObjectManager`. -- [FlatFileWriter (`openspout/openspout`)](https://github.com/yokai-php/batch-openspout/blob/0.x/src/Writer/FlatFileWriter.php): - write items to any CSV/ODS/XLSX file. - -**Item writers for testing purpose:** -- [InMemoryWriter](../../../src/Test/Job/Item/Writer/InMemoryWriter.php): - write in a private var which can be accessed afterward in your tests. -- [TestDebugWriter](../../../src/Test/Job/Item/Writer/TestDebugWriter.php): - dummy item writer that you can use in your unit tests. - -## On the same subject - -- [What is an item job ?](../item-job.md) diff --git a/tests/convention/Documentation/Markdown.php b/tests/convention/Documentation/Markdown.php index 5f4c0345..ddb3746d 100644 --- a/tests/convention/Documentation/Markdown.php +++ b/tests/convention/Documentation/Markdown.php @@ -27,7 +27,7 @@ final class Markdown */ public static function listFiles(): iterable { - $files = Finder::create()->files()->in(self::ROOT_DIR . '/src/*/')->name('*.md'); + $files = Finder::create()->files()->in(self::ROOT_DIR . '/docs/*/')->name('*.md'); foreach ($files as $file) { yield self::createDocFile($file); @@ -39,7 +39,7 @@ public static function listFiles(): iterable */ public static function getFile(string $path): DocFile { - return self::createDocFile(new SplFileInfo(self::ROOT_DIR . '/src/' . \ltrim($path, '/'))); + return self::createDocFile(new SplFileInfo(self::ROOT_DIR . '/' . \ltrim($path, '/'))); } private static function createDocFile(SplFileInfo $file): DocFile @@ -83,13 +83,13 @@ private static function listLinksInFile(string $path, string $filePackage): Gene private static function getPackageFromFile(SplFileInfo $file): string { - $relativePath = \str_replace(\realpath(self::ROOT_DIR) . '/src/', '', $file->getRealPath()); + $relativePath = \str_replace(\realpath(self::ROOT_DIR) . '/', '', $file->getRealPath()); return \dirname($relativePath); } private static function getFileFromMembers(string $package, string $file): SplFileInfo { - return new SplFileInfo(self::ROOT_DIR . '/src/' . $package . '/' . \ltrim($file, '/')); + return new SplFileInfo(self::ROOT_DIR . '/' . $package . '/' . \ltrim($file, '/')); } } diff --git a/tests/convention/Documentation/MarkdownLinksTest.php b/tests/convention/Documentation/MarkdownLinksTest.php index ebc76b00..eb6616ec 100644 --- a/tests/convention/Documentation/MarkdownLinksTest.php +++ b/tests/convention/Documentation/MarkdownLinksTest.php @@ -105,31 +105,31 @@ public function testComponentsAreListed(string $filepath, string $interface): vo public function interfaceRules(): iterable { yield 'JobInterface' => [ - 'batch/docs/domain/job.md', + 'docs/batch/domain/job.md', JobInterface::class, ]; yield 'JobExecutionStorageInterface' => [ - 'batch/docs/domain/job-execution-storage.md', + 'docs/batch/domain/job-execution-storage.md', JobExecutionStorageInterface::class, ]; yield 'JobLauncherInterface' => [ - 'batch/docs/domain/job-launcher.md', + 'docs/batch/domain/job-launcher.md', JobLauncherInterface::class, ]; yield 'JobParameterAccessorInterface' => [ - 'batch/docs/domain/job-parameter-accessor.md', + 'docs/batch/domain/job-parameter-accessor.md', JobParameterAccessorInterface::class, ]; yield 'ItemReaderInterface' => [ - 'batch/docs/domain/item-job/item-reader.md', + 'docs/batch/domain/item-job/item-reader.md', ItemReaderInterface::class, ]; yield 'ItemProcessorInterface' => [ - 'batch/docs/domain/item-job/item-processor.md', + 'docs/batch/domain/item-job/item-processor.md', ItemProcessorInterface::class, ]; yield 'ItemWriterInterface' => [ - 'batch/docs/domain/item-job/item-writer.md', + 'docs/batch/domain/item-job/item-writer.md', ItemWriterInterface::class, ]; }