mirror of
https://github.com/code-rhapsodie/dataflow-bundle.git
synced 2026-04-23 22:28:10 +02:00
4e82b114c4
* Add auto update count processed item while running job
30 lines
634 B
PHP
30 lines
634 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace CodeRhapsodie\DataflowBundle\Factory;
|
|
|
|
use Symfony\Component\DependencyInjection\Container;
|
|
|
|
/**
|
|
* Class ConnectionFactory.
|
|
*
|
|
* @codeCoverageIgnore
|
|
*/
|
|
class ConnectionFactory
|
|
{
|
|
public function __construct(private Container $container, private string $connectionName)
|
|
{
|
|
}
|
|
|
|
public function setConnectionName(string $connectionName)
|
|
{
|
|
$this->connectionName = $connectionName;
|
|
}
|
|
|
|
public function getConnection(): \Doctrine\DBAL\Connection
|
|
{
|
|
return $this->container->get(\sprintf('doctrine.dbal.%s_connection', $this->connectionName));
|
|
}
|
|
}
|