Repository navigation
Expand file tree
/
Copy pathDoctrineTransport.php
More file actions
57 lines (49 loc) · 1.68 KB
/
Copy pathDoctrineTransport.php
File metadata and controls
57 lines (49 loc) · 1.68 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
declare(strict_types=1);
namespace SchedulerBundle\Bridge\Doctrine\Transport;
use Doctrine\DBAL\Connection as DbalConnection;
use Doctrine\DBAL\Schema\Schema;
use SchedulerBundle\Bridge\Doctrine\SchemaAwareInterface;
use SchedulerBundle\SchedulePolicy\SchedulePolicyOrchestratorInterface;
use SchedulerBundle\Task\LazyTaskList;
use SchedulerBundle\Task\TaskListInterface;
use SchedulerBundle\Transport\AbstractExternalTransport;
use SchedulerBundle\Transport\Configuration\ConfigurationInterface;
use Symfony\Component\Serializer\SerializerInterface;
/**
* @author Guillaume Loulier <contact@guillaumeloulier.fr>
*/
class DoctrineTransport extends AbstractExternalTransport implements SchemaAwareInterface
{
public function __construct(
ConfigurationInterface $configuration,
DbalConnection $dbalConnection,
SerializerInterface $serializer,
SchedulePolicyOrchestratorInterface $schedulePolicyOrchestrator
) {
parent::__construct($configuration, new Connection(
$configuration,
$dbalConnection,
$serializer,
$schedulePolicyOrchestrator
), $schedulePolicyOrchestrator);
}
/**
* {@inheritdoc}
*/
public function list(bool $lazy = false): TaskListInterface|LazyTaskList
{
$list = $this->connection->list();
return $lazy ? new LazyTaskList($list) : $list;
}
/**
* {@inheritdoc}
*/
public function configureSchema(Schema $schema, DbalConnection $dbalConnection): void
{
if (!$this->connection instanceof Connection) {
return;
}
$this->connection->configureSchema($schema, $dbalConnection);
}
}