forked from php-enqueue/enqueue-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDbalDriver.php
More file actions
29 lines (24 loc) · 742 Bytes
/
Copy pathDbalDriver.php
File metadata and controls
29 lines (24 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
namespace Enqueue\Client\Driver;
use Enqueue\Dbal\DbalContext;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
/**
* @method DbalContext getContext
*/
class DbalDriver extends GenericDriver
{
public function __construct(DbalContext $context, ...$args)
{
parent::__construct($context, ...$args);
}
public function setupBroker(?LoggerInterface $logger = null): void
{
$logger = $logger ?: new NullLogger();
$log = function ($text, ...$args) use ($logger) {
$logger->debug(sprintf('[DbalDriver] '.$text, ...$args));
};
$log('Creating database table: "%s"', $this->getContext()->getTableName());
$this->getContext()->createDataBaseTable();
}
}