⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
shopware
/
vendor
/
enqueue
/
dbal
/
View File Name :
ManagerRegistryConnectionFactory.php
<?php declare(strict_types=1); namespace Enqueue\Dbal; use Doctrine\DBAL\Connection; use Doctrine\Persistence\ManagerRegistry; use Interop\Queue\ConnectionFactory; use Interop\Queue\Context; class ManagerRegistryConnectionFactory implements ConnectionFactory { /** * @var ManagerRegistry */ private $registry; /** * @var array */ private $config; /** * $config = [ * 'connection_name' => null, - doctrine dbal connection name * 'table_name' => 'enqueue', - database table name. * 'polling_interval' => 1000, - How often query for new messages (milliseconds) * 'lazy' => true, - Use lazy database connection (boolean) * ]. */ public function __construct(ManagerRegistry $registry, array $config = []) { $this->config = array_replace([ 'connection_name' => null, 'lazy' => true, ], $config); $this->registry = $registry; } /** * @return DbalContext */ public function createContext(): Context { if ($this->config['lazy']) { return new DbalContext(function () { return $this->establishConnection(); }, $this->config); } return new DbalContext($this->establishConnection(), $this->config); } public function close(): void { } private function establishConnection(): Connection { $connection = $this->registry->getConnection($this->config['connection_name']); $connection->connect(); return $connection; } }