Skip to content

Commit 1681941

Browse files
committed
add check to pass
1 parent b85ce24 commit 1681941

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterDatePointTypePass.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@
1212
namespace Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass;
1313

1414
use Symfony\Bridge\Doctrine\Types\DatePointType;
15+
use Symfony\Component\Clock\DatePoint;
1516
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1617
use Symfony\Component\DependencyInjection\ContainerBuilder;
1718

1819
final class RegisterDatePointTypePass implements CompilerPassInterface
1920
{
2021
public function process(ContainerBuilder $container): void
2122
{
23+
if (!class_exists(DatePoint::class)) {
24+
return;
25+
}
26+
2227
if (!$container->hasParameter('doctrine.dbal.connection_factory.types')) {
2328
return;
2429
}
2530

26-
$name = DatePointType::NAME;
2731
$typeDefinition = $container->getParameter('doctrine.dbal.connection_factory.types');
2832

29-
if (!isset($typeDefinition[$name])) {
30-
$typeDefinition[$name] = ['class' => DatePointType::class];
33+
if (!isset($typeDefinition['date_point'])) {
34+
$typeDefinition['date_point'] = ['class' => DatePointType::class];
3135
}
3236

3337
$container->setParameter('doctrine.dbal.connection_factory.types', $typeDefinition);

0 commit comments

Comments
 (0)