Skip to content

Commit

Permalink
Merge pull request #135 from gyKa/issue-128
Browse files Browse the repository at this point in the history
Remove Entity\SyncJobs and refactor code.
  • Loading branch information
trylika committed Feb 2, 2015
2 parents 834af1d + c09ea2d commit a3818a1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 290 deletions.
270 changes: 0 additions & 270 deletions Entity/SyncJob.php

This file was deleted.

12 changes: 6 additions & 6 deletions Sync/DiffProvider/Binlog/BinlogParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ONGR\ConnectionsBundle\Sync\DiffProvider\Binlog;

use ONGR\ConnectionsBundle\Entity\SyncJob;
use ONGR\ConnectionsBundle\Sync\ActionTypes;

/**
* Parses binary log data (Interpreter).
Expand Down Expand Up @@ -225,11 +225,11 @@ protected function parseQuery()

$this->getNextLine(self::LINE_TYPE_QUERY);

if ($buffer['type'] == SyncJob::TYPE_DELETE || $buffer['type'] === SyncJob::TYPE_UPDATE) {
if ($buffer['type'] == ActionTypes::DELETE || $buffer['type'] === ActionTypes::UPDATE) {
$buffer['where'] = $this->handleStatement($this->lastLine, self::STATEMENT_TYPE_WHERE);
}

if ($buffer['type'] == SyncJob::TYPE_CREATE || $buffer['type'] === SyncJob::TYPE_UPDATE) {
if ($buffer['type'] == ActionTypes::CREATE || $buffer['type'] === ActionTypes::UPDATE) {
$buffer['set'] = $this->handleStatement($this->lastLine, self::STATEMENT_TYPE_SET);
}

Expand Down Expand Up @@ -487,11 +487,11 @@ protected function detectQueryType($type)
{
switch ($type) {
case 'INSERT INTO':
return SyncJob::TYPE_CREATE;
return ActionTypes::CREATE;
case 'UPDATE':
return SyncJob::TYPE_UPDATE;
return ActionTypes::UPDATE;
case 'DELETE FROM':
return SyncJob::TYPE_DELETE;
return ActionTypes::DELETE;
default:
throw new \UnexpectedValueException("Unknown statement of type {$type}");
}
Expand Down
8 changes: 4 additions & 4 deletions Sync/DiffProvider/Item/DiffItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace ONGR\ConnectionsBundle\Sync\DiffProvider\Item;

use ONGR\ConnectionsBundle\Entity\SyncJob;
use ONGR\ConnectionsBundle\Sync\ActionTypes;

/**
* DiffItem factory.
Expand All @@ -29,11 +29,11 @@ class DiffItemFactory
public static function create($type)
{
switch ($type) {
case SyncJob::TYPE_CREATE:
case ActionTypes::CREATE:
return new CreateDiffItem();
case SyncJob::TYPE_UPDATE:
case ActionTypes::UPDATE:
return new UpdateDiffItem();
case SyncJob::TYPE_DELETE:
case ActionTypes::DELETE:
return new DeleteDiffItem();
default:
throw new \InvalidArgumentException("Invalid type {$type}");
Expand Down
Loading

0 comments on commit a3818a1

Please sign in to comment.