generated from dunglas/symfony-docker
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
40 lines (31 loc) · 1.15 KB
/
test.php
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
<?php
/**
* All credits to Grégoire Pineau (@lyrixx)
* https://gist.github.com/lyrixx/2ea147609dc632d26e366aef60f61a9f
*/
declare(strict_types=1);
require_once __DIR__ . '/vendor/autoload_runtime.php';
use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Console\Output\StreamOutput;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
return function () {
$k = new class('dev', true) extends Kernel implements CompilerPassInterface {
use MicroKernelTrait;
public function process(ContainerBuilder $container)
{
$container->getAlias('logger')
->setPublic(true);
$container->getDefinition('monolog.handler.console')
->setPublic(true);
}
};
$k->boot();
$c = $k->getContainer();
$c->get('monolog.handler.console')
->setOutput(new StreamOutput(fopen('php://stdout', 'w'), StreamOutput::VERBOSITY_VERY_VERBOSE));
$logger = $c->get('logger');
$em = $c->get('doctrine.orm.entity_manager');
// Start of playground
};