Skip to content

Commit

Permalink
fix skip mode using tablesOnly and databasesOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
kobi97 committed Nov 17, 2016
1 parent 8a68978 commit b12d5b4
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/MySQLReplication/Event/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ public function consume()
);

if (ConstEventType::TABLE_MAP_EVENT === $eventInfo->getType()) {
$this->eventDispatcher->dispatch(ConstEventsNames::TABLE_MAP, $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeTableMapDTO());
$event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeTableMapDTO();
if ($event !== null) {
$this->eventDispatcher->dispatch(ConstEventsNames::TABLE_MAP, $event);
}
} else {
if ([] !== $this->config->getEventsOnly() && !in_array($eventInfo->getType(), $this->config->getEventsOnly(), true)) {
return;
Expand All @@ -97,11 +100,20 @@ public function consume()
}

if (in_array($eventInfo->getType(), [ConstEventType::UPDATE_ROWS_EVENT_V1, ConstEventType::UPDATE_ROWS_EVENT_V2], true)) {
$this->eventDispatcher->dispatch(ConstEventsNames::UPDATE, $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeUpdateRowsDTO());
$event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeUpdateRowsDTO();
if ($event !== null) {
$this->eventDispatcher->dispatch(ConstEventsNames::UPDATE, $event);
}
} elseif (in_array($eventInfo->getType(), [ConstEventType::WRITE_ROWS_EVENT_V1, ConstEventType::WRITE_ROWS_EVENT_V2], true)) {
$this->eventDispatcher->dispatch(ConstEventsNames::WRITE, $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeWriteRowsDTO());
$event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeWriteRowsDTO();
if ($event !== null) {
$this->eventDispatcher->dispatch(ConstEventsNames::WRITE, $event);
}
} elseif (in_array($eventInfo->getType(), [ConstEventType::DELETE_ROWS_EVENT_V1, ConstEventType::DELETE_ROWS_EVENT_V2], true)) {
$this->eventDispatcher->dispatch(ConstEventsNames::DELETE, $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeDeleteRowsDTO());
$event = $this->rowEventService->makeRowEvent($binaryDataReader, $eventInfo)->makeDeleteRowsDTO();
if ($event !== null) {
$this->eventDispatcher->dispatch(ConstEventsNames::DELETE, $event);
}
} elseif (ConstEventType::XID_EVENT === $eventInfo->getType()) {
$this->eventDispatcher->dispatch(ConstEventsNames::XID, (new XidEvent($eventInfo, $binaryDataReader))->makeXidDTO());
} elseif (ConstEventType::ROTATE_EVENT === $eventInfo->getType()) {
Expand Down

0 comments on commit b12d5b4

Please sign in to comment.