Skip to content

Commit

Permalink
remove extra geocodable sql call
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Dec 18, 2019
1 parent f889154 commit 5e4b3df
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"jakub-onderka/php-parallel-lint": "^1.0",
"phpstan/phpstan": "^0.12.2",
"phpunit/phpunit": "^8.5",
"rector/rector": "^0.6.1",
"rector/rector": "dev-master",
"symplify/easy-coding-standard": "^7.1",
"symplify/phpstan-extensions": "^7.1",
"phpstan/phpstan-doctrine": "^0.12.4",
Expand All @@ -52,9 +52,9 @@
}
},
"scripts": {
"check-cs": "ecs check src tests --ansi",
"fix-cs": "ecs check src tests --fix --ansi",
"phpstan": "phpstan analyse src tests --ansi --error-format symplify",
"rector": "rector process --config rector-ci.yaml"
"check-cs": "vendor/bin/ecs check src tests --ansi",
"fix-cs": "vendor/bin/ecs check src tests --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse src tests --ansi --error-format symplify",
"rector": "vendor/bin/rector process --config rector-ci.yaml"
}
}
4 changes: 0 additions & 4 deletions src/ORM/Geocodable/GeocodableSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ private function updateLocation(LifecycleEventArgs $lifecycleEventArgs, $overrid
}

$unitOfWork->propertyChanged($entity, 'location', $oldValue, $entity->getLocation());

$unitOfWork->scheduleExtraUpdate($entity, [
'location' => [$oldValue, $entity->getLocation()],
]);
}
}
}
11 changes: 7 additions & 4 deletions tests/ORM/BlameableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@ public function testUpdate(): void
$this->entityManager->flush();
$this->entityManager->clear();

$this->assertCount(3, $this->debugStack->queries);
$this->assertSame('"START TRANSACTION"', $this->debugStack->queries[1]['sql']);
$expectedCount = $this->isPostgreSql() ? 4 : 3;
$startKey = $this->isPostgreSql() ? 2 : 1;

$this->assertCount($expectedCount, $this->debugStack->queries);
$this->assertSame('"START TRANSACTION"', $this->debugStack->queries[$startKey]['sql']);
$this->assertSame(
'UPDATE BlameableEntity SET title = ?, updatedBy = ? WHERE id = ?',
$this->debugStack->queries[2]['sql']
$this->debugStack->queries[$startKey + 1]['sql']
);
$this->assertSame('"COMMIT"', $this->debugStack->queries[3]['sql']);
$this->assertSame('"COMMIT"', $this->debugStack->queries[$startKey + 2]['sql']);

/** @var BlameableEntity $entity */
$entity = $this->blameableRepository->find($id);
Expand Down

0 comments on commit 5e4b3df

Please sign in to comment.