Skip to content

Commit

Permalink
Removed NullEventDispatcher in favor of a (working) built-in event di…
Browse files Browse the repository at this point in the history
…spatcher
  • Loading branch information
bpolaszek committed Mar 8, 2017
1 parent f815238 commit eb31f75
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 54 deletions.
2 changes: 1 addition & 1 deletion doc/Concept.md
Expand Up @@ -70,7 +70,7 @@ Advanced Usage
The `BenTools\ETL\Runner\ETLRunner` constructor accepts 2 optionnal arguments:

* A `Psr\Log\LoggerInterface` logger like Monolog to get some info about the ETL process
* A `BenTools\ETL\Event\EventDispatcher\EventDispatcherInterface` event manager of your own (or use the Symfony Bridge provided) to hook on the ETL process (see [Events](Events.md)).
* A `BenTools\ETL\Event\EventDispatcher\EventDispatcherInterface` event manager of your own (or use either our built-in Event Dispatcher or the Symfony Bridge provided) to hook on the ETL process (see [Events](Events.md)).


Next: [Getting started](GettingStarted.md)
24 changes: 16 additions & 8 deletions doc/Events.md
@@ -1,35 +1,43 @@
Event Dispatcher
================

The library ships with a built-in Event dispatcher that allow you to hook at different points within the ETL process.

If you're running Symfony, you can use Symfony's Event Dispatcher by wrapping it within into the `BenTools\ETL\Event\EventDispatcher\Bridge\Symfony\SymfonyEventDispatcherBridge` class.

You're also free to create your own bridge if you're using another framework, just implement `BenTools\ETL\Event\EventDispatcher\EventDispatcherInterface`.

ETL Events
==========

You can hook anywhere into the ETL process by using your own Event Dispatcher
(just implement the `BenTools\ETL\Event\EventDispatcher\EventDispatcherInterface`) or by using Symfony's Event dispatcher thanks o the Bridge provided.
These events (see `BenTools\ETL\Event\ETLEvents`) are fired by `BenTools\ETL\Runner\ETLRunner` during the loop.

BenTools\ETL\Event\ETLEvents::START
ETLEvents::START
-----------------------------------
This event is fired just before beginning iterating.

BenTools\ETL\Event\ETLEvents::AFTER_EXTRACT
ETLEvents::AFTER_EXTRACT
-------------------------------------------
This event is fired after an item's extraction. You get a fresh `BenTools\ETL\Context\ContextElement` object.

BenTools\ETL\Event\ETLEvents::AFTER_TRANSFORM
ETLEvents::AFTER_TRANSFORM
-------------------------------------------
This event is fired once the item is transformed. You get the `BenTools\ETL\Context\ContextElement` object with the transformed data.

BenTools\ETL\Event\ETLEvents::AFTER_LOAD
ETLEvents::AFTER_LOAD
-------------------------------------------
This event is fired on load. You have access to the `BenTools\ETL\Context\ContextElement` object.

**Note**: For loaders that implement `BenTools\ETL\Loader\FlushableLoaderInterface`, like `BenTools\ETL\Loader\DoctrineORMLoader` a loaded object does not necessarily mean it is already commited to the persistence layer.

BenTools\ETL\Event\ETLEvents::AFTER_FLUSH
ETLEvents::AFTER_FLUSH
-------------------------------------------
This event is fired when a `BenTools\ETL\Loader\FlushableLoaderInterface` loader flushes waiting objects.

You can't get a `BenTools\ETL\Context\ContextElement` object since it is a global event.


BenTools\ETL\Event\ETLEvents::END
ETLEvents::END
-----------------------------------
This event is fired when the process is finished.

Expand Down
22 changes: 0 additions & 22 deletions src/Event/EventDispatcher/NullEventDispatcher.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Runner/ETLRunner.php
Expand Up @@ -6,7 +6,6 @@
use BenTools\ETL\Event\ContextElementEvent;
use BenTools\ETL\Event\EventDispatcher\ETLEventDispatcher;
use BenTools\ETL\Event\EventDispatcher\EventDispatcherInterface;
use BenTools\ETL\Event\EventDispatcher\NullEventDispatcher;
use BenTools\ETL\Event\ETLEvents;
use BenTools\ETL\Event\ETLEvent;
use BenTools\ETL\Extractor\ExtractorInterface;
Expand Down
22 changes: 0 additions & 22 deletions tests/src/Event/EventDispatcher/NullEventDispatcherTest.php

This file was deleted.

0 comments on commit eb31f75

Please sign in to comment.