Repository navigation
Expand file tree
/
Copy pathCoreBundle.php
More file actions
47 lines (40 loc) · 1.6 KB
/
Copy pathCoreBundle.php
File metadata and controls
47 lines (40 loc) · 1.6 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
<?php
declare(strict_types=1);
namespace Jul6Art\CoreBundle;
use Jul6Art\CoreBundle\DependencyInjection\Compiler\PerformanceCommandPass;
use Jul6Art\CoreBundle\DependencyInjection\Compiler\PurgeCommandPass;
use Jul6Art\CoreBundle\Doctrine\Type\EncryptedTypeRegistrar;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class CoreBundle.
*/
class CoreBundle extends Bundle
{
#[\Override]
public function build(ContainerBuilder $container): void
{
parent::build($container);
$container->addCompilerPass(new PurgeCommandPass());
$container->addCompilerPass(new PerformanceCommandPass());
}
/**
* The `encrypted_string` type gets its encryptor as soon as the kernel boots, and not only at the
* first request or console command (the registrar's two listeners): code that writes an encrypted
* column before either — a test that persists in `setUp()`, a kernel booted by hand — found the
* type without it (« EncryptedStringType has no Encryptor »), depending on which test a process
* happened to run first.
*/
#[\Override]
public function boot(): void
{
parent::boot();
if ($this->container instanceof ContainerInterface && $this->container->has(EncryptedTypeRegistrar::class)) {
$registrar = $this->container->get(EncryptedTypeRegistrar::class);
if ($registrar instanceof EncryptedTypeRegistrar) {
$registrar->register();
}
}
}
}