-
-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
I try to configure in project with doctrine/dbal
. I create a bootstrap:
<?php
declare(strict_types=1);
use Doctrine\DBAL\Connection;
use OndraM\CiDetector\CiDetector;
use Psr\Container\ContainerInterface;
use staabm\PHPStanDba\DbSchema\SchemaHasherMysql;
use staabm\PHPStanDba\QueryReflection\PdoMysqlQueryReflector;
use staabm\PHPStanDba\QueryReflection\QueryReflection;
use staabm\PHPStanDba\QueryReflection\ReflectionCache;
use staabm\PHPStanDba\QueryReflection\ReplayAndRecordingQueryReflector;
use staabm\PHPStanDba\QueryReflection\ReplayQueryReflector;
use staabm\PHPStanDba\QueryReflection\RuntimeConfiguration;
require_once __DIR__ . '/../vendor/autoload.php';
$cacheFile = __DIR__ . '/../data/cache/.phpstan-dba.cache';
$reflectionCache = ReflectionCache::create($cacheFile);
$isCi = ! (new CiDetector())->isCiDetected();
$runtimeConfiguration = new RuntimeConfiguration();
if (! $isCi) {
$runtimeConfiguration->debugMode(true);
$runtimeConfiguration->analyzeQueryPlans();
// $runtimeConfiguration->utilizeSqlAst(true);
/** @var ContainerInterface $container */
$container = require __DIR__ . '/container.php';
/** @var Connection $connection */
$connection = $container->get(Connection::class);
$nativeConnection = $connection->getNativeConnection();
} else {
print PHP_EOL . PHP_EOL . 'CI detected' . PHP_EOL . PHP_EOL;
}
$queryReflector = $isCi
? new ReplayQueryReflector($reflectionCache)
: new ReplayAndRecordingQueryReflector(
$reflectionCache,
new PdoMysqlQueryReflector($nativeConnection),
new SchemaHasherMysql($nativeConnection),
);
QueryReflection::setupReflector($queryReflector, $runtimeConfiguration);
An locally everything works fine. But when I run phpstan on CI, then I get many errors where I use Doctrine\DBAL\Connection::delete
or Doctrine\DBAL\Connection::insert
Query error: Table "table_name" does not exist
Metadata
Metadata
Assignees
Labels
No labels