private function init(bool
$withStopwatch = true
): void
{ $this->stopwatch =
$withStopwatch ?
new Stopwatch() : null;
$config = ORMSetup::
createConfiguration(true
);
if (class_exists(DefaultSchemaManagerFactory::
class)) { $config->
setSchemaManagerFactory(new DefaultSchemaManagerFactory());
} $config->
setLazyGhostObjectEnabled(true
);
$this->debugDataHolder =
new DebugDataHolder();
$config->
setMiddlewares([new Middleware($this->debugDataHolder,
$this->stopwatch
)]);
$this->conn = DriverManager::
getConnection([ 'driver' => 'pdo_sqlite',
'memory' => true,
],
$config);
$this->conn->
executeQuery(<<<EOT
CREATE TABLE products (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
price REAL NOT NULL,
stock INTEGER NOT NULL,
picture BLOB NULL,
tags TEXT NULL,
created_at TEXT NULL
);