update some queries in the interface to take into account history of user's scope and user's job

This commit is contained in:
2023-10-11 15:14:27 +02:00
parent 363785b779
commit 978db5a5c5
14 changed files with 210 additions and 57 deletions

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace Chill\MainBundle\Service\EntityInfo;
use Doctrine\DBAL\Connection;
use Psr\Log\LoggerInterface;
class ViewEntityInfoManager
{
@@ -21,6 +22,7 @@ class ViewEntityInfoManager
*/
private readonly iterable $vienEntityInfoProviders,
private readonly Connection $connection,
private readonly LoggerInterface $logger,
) {}
public function synchronizeOnDB(): void
@@ -28,6 +30,8 @@ class ViewEntityInfoManager
$this->connection->transactional(function (Connection $conn): void {
foreach ($this->vienEntityInfoProviders as $viewProvider) {
foreach ($this->createOrReplaceViewSQL($viewProvider, $viewProvider->getViewName()) as $sql) {
$this->logger->debug("Will execute create view sql", ['sql' => $sql]);
$this->logger->debug($sql);
$conn->executeQuery($sql);
}
}
@@ -41,7 +45,7 @@ class ViewEntityInfoManager
{
return [
"DROP VIEW IF EXISTS {$viewName}",
sprintf("CREATE VIEW {$viewName} AS %s", $viewProvider->getViewQuery())
sprintf("CREATE OR REPLACE VIEW {$viewName} AS %s", $viewProvider->getViewQuery())
];
}
}