| Total Complexity | 6 |
| Total Lines | 35 |
| Duplicated Lines | 0 % |
| Coverage | 88.89% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class TransactionEventListener |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var TransactionInterface |
||
| 13 | */ |
||
| 14 | private $transaction; |
||
| 15 | |||
| 16 | 1 | public function __construct(TransactionInterface $transaction) |
|
| 17 | { |
||
| 18 | 1 | $this->transaction = $transaction; |
|
| 19 | 1 | } |
|
| 20 | |||
| 21 | 1 | public function postPersist(LifecycleEvent $event) |
|
| 22 | { |
||
| 23 | 1 | $this->transaction->addCreated($event->getObject()); |
|
| 24 | 1 | } |
|
| 25 | |||
| 26 | 1 | public function preUpdate(LifecycleEvent $event) |
|
| 27 | { |
||
| 28 | 1 | $object = $event->getObject(); |
|
| 29 | 1 | $original = $event->getObjectManager()->getUnitOfWork()->getOriginalObject($object); |
|
|
|
|||
| 30 | 1 | $this->transaction->addUpdated($original); |
|
| 31 | 1 | } |
|
| 32 | |||
| 33 | 1 | public function postRemove(LifecycleEvent $event) |
|
| 34 | { |
||
| 35 | 1 | $this->transaction->addDeleted($event->getObject()); |
|
| 36 | 1 | } |
|
| 37 | |||
| 38 | 1 | public function onException() |
|
| 44 | } |
||
| 45 | 1 | } |
|
| 46 | } |
||
| 47 |