portiny /
doctrine
| 1 | <?php declare(strict_types = 1); |
||
| 2 | |||
| 3 | namespace Portiny\Doctrine\Tests; |
||
| 4 | |||
| 5 | use Nette\Configurator; |
||
| 6 | use Nette\DI\Container; |
||
| 7 | use Nette\Utils\FileSystem; |
||
| 8 | |||
| 9 | final class ContainerFactory |
||
| 10 | { |
||
| 11 | |||
| 12 | public static function create(): Container |
||
| 13 | { |
||
| 14 | $tempDir = __DIR__ . '/temp/' . getmypid(); |
||
| 15 | |||
| 16 | if (! file_exists($tempDir . '/log')) { |
||
| 17 | mkdir($tempDir . '/log', 0777, true); |
||
| 18 | } |
||
| 19 | |||
| 20 | register_shutdown_function(function (): void { |
||
| 21 | FileSystem::delete(__DIR__ . '/temp'); |
||
| 22 | }); |
||
| 23 | |||
| 24 | $configurator = new Configurator(); |
||
|
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||
| 25 | $configurator->setTempDirectory($tempDir); |
||
| 26 | $configurator->addConfig(__DIR__ . '/config/config.neon'); |
||
| 27 | |||
| 28 | return $configurator->createContainer(); |
||
| 29 | } |
||
| 30 | |||
| 31 | } |
||
| 32 |