Skip to content

Commit

Permalink
Merge pull request #15 from kobi97/fix_skip_data_bug
Browse files Browse the repository at this point in the history
fix skip mode using tablesOnly and databasesOnly
  • Loading branch information
krowinski authored Nov 19, 2016
2 parents 8a68978 + b12d5b4 commit 15c40a7
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 15c40a7

Please sign in to comment.