zenstruck /
foundry
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Zenstruck\Foundry\Tests\Fixtures; |
||||
| 4 | |||||
| 5 | use DAMA\DoctrineTestBundle\DAMADoctrineTestBundle; |
||||
| 6 | use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
||||
| 7 | use Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle; |
||||
| 8 | use Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle; |
||||
| 9 | use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
||||
| 10 | use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
||||
| 11 | use Symfony\Bundle\MakerBundle\MakerBundle; |
||||
| 12 | use Symfony\Component\Config\Loader\LoaderInterface; |
||||
| 13 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
||||
| 14 | use Symfony\Component\HttpKernel\Kernel as BaseKernel; |
||||
| 15 | use Symfony\Component\Routing\RouteCollectionBuilder; |
||||
| 16 | use Zenstruck\Foundry\Tests\Fixtures\Factories\CategoryFactory; |
||||
| 17 | use Zenstruck\Foundry\Tests\Fixtures\Factories\CategoryServiceFactory; |
||||
| 18 | use Zenstruck\Foundry\Tests\Fixtures\Stories\ServiceStory; |
||||
| 19 | use Zenstruck\Foundry\ZenstruckFoundryBundle; |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * @author Kevin Bond <[email protected]> |
||||
| 23 | */ |
||||
| 24 | class Kernel extends BaseKernel |
||||
| 25 | { |
||||
| 26 | use MicroKernelTrait; |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 27 | |||||
| 28 | public function registerBundles(): iterable |
||||
| 29 | { |
||||
| 30 | yield new FrameworkBundle(); |
||||
| 31 | |||||
| 32 | if (\getenv('DATABASE_URL')) { |
||||
| 33 | yield new DoctrineBundle(); |
||||
| 34 | } |
||||
| 35 | |||||
| 36 | yield new MakerBundle(); |
||||
| 37 | |||||
| 38 | if (\getenv('USE_FOUNDRY_BUNDLE')) { |
||||
| 39 | yield new ZenstruckFoundryBundle(); |
||||
| 40 | } |
||||
| 41 | |||||
| 42 | if (\getenv('USE_DAMA_DOCTRINE_TEST_BUNDLE')) { |
||||
| 43 | yield new DAMADoctrineTestBundle(); |
||||
| 44 | } |
||||
| 45 | |||||
| 46 | if ('migrate' === \getenv('FOUNDRY_RESET_MODE')) { |
||||
| 47 | yield new DoctrineMigrationsBundle(); |
||||
| 48 | } |
||||
| 49 | |||||
| 50 | if (\getenv('MONGO_URL')) { |
||||
| 51 | yield new DoctrineMongoDBBundle(); |
||||
| 52 | } |
||||
| 53 | } |
||||
| 54 | |||||
| 55 | protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader): void |
||||
|
0 ignored issues
–
show
The parameter
$loader is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 56 | { |
||||
| 57 | $c->register(Service::class); |
||||
| 58 | $c->register(ServiceStory::class) |
||||
| 59 | ->setAutoconfigured(true) |
||||
| 60 | ->setAutowired(true) |
||||
| 61 | ; |
||||
| 62 | $c->register(CategoryFactory::class) |
||||
| 63 | ->setAutoconfigured(true) |
||||
| 64 | ->setAutowired(true) |
||||
| 65 | ; |
||||
| 66 | $c->register(CategoryServiceFactory::class) |
||||
| 67 | ->setAutoconfigured(true) |
||||
| 68 | ->setAutowired(true) |
||||
| 69 | ; |
||||
| 70 | |||||
| 71 | $c->loadFromExtension('framework', [ |
||||
| 72 | 'secret' => 'S3CRET', |
||||
| 73 | 'test' => true, |
||||
| 74 | ]); |
||||
| 75 | |||||
| 76 | if (\getenv('DATABASE_URL')) { |
||||
| 77 | $c->loadFromExtension( |
||||
| 78 | 'doctrine', |
||||
| 79 | [ |
||||
| 80 | 'dbal' => ['url' => '%env(resolve:DATABASE_URL)%'], |
||||
| 81 | 'orm' => [ |
||||
| 82 | 'auto_generate_proxy_classes' => true, |
||||
| 83 | 'auto_mapping' => true, |
||||
| 84 | 'mappings' => [ |
||||
| 85 | 'Test' => [ |
||||
| 86 | 'is_bundle' => false, |
||||
| 87 | 'type' => 'annotation', |
||||
| 88 | 'dir' => '%kernel.project_dir%/tests/Fixtures/Entity', |
||||
| 89 | 'prefix' => 'Zenstruck\Foundry\Tests\Fixtures\Entity', |
||||
| 90 | 'alias' => 'Test', |
||||
| 91 | ], |
||||
| 92 | ], |
||||
| 93 | ], |
||||
| 94 | ] |
||||
| 95 | ); |
||||
| 96 | } |
||||
| 97 | |||||
| 98 | if (\getenv('USE_FOUNDRY_BUNDLE')) { |
||||
| 99 | $c->loadFromExtension('zenstruck_foundry', [ |
||||
| 100 | 'auto_refresh_proxies' => false, |
||||
| 101 | ]); |
||||
| 102 | } |
||||
| 103 | |||||
| 104 | if ('migrate' === \getenv('FOUNDRY_RESET_MODE')) { |
||||
| 105 | $c->loadFromExtension('doctrine_migrations', [ |
||||
| 106 | 'migrations_paths' => [ |
||||
| 107 | 'Zenstruck\Foundry\Tests\Fixtures\Migrations' => '%kernel.project_dir%/tests/Fixtures/Migrations', |
||||
| 108 | ], |
||||
| 109 | ]); |
||||
| 110 | } |
||||
| 111 | |||||
| 112 | if (\getenv('MONGO_URL')) { |
||||
| 113 | $c->loadFromExtension('doctrine_mongodb', [ |
||||
| 114 | 'connections' => [ |
||||
| 115 | 'default' => ['server' => '%env(resolve:MONGO_URL)%'], |
||||
| 116 | ], |
||||
| 117 | 'default_database' => 'mongo', |
||||
| 118 | 'document_managers' => [ |
||||
| 119 | 'default' => [ |
||||
| 120 | 'auto_mapping' => true, |
||||
| 121 | 'mappings' => [ |
||||
| 122 | 'Test' => [ |
||||
| 123 | 'is_bundle' => false, |
||||
| 124 | 'type' => 'annotation', |
||||
| 125 | 'dir' => '%kernel.project_dir%/tests/Fixtures/Document', |
||||
| 126 | 'prefix' => 'Zenstruck\Foundry\Tests\Fixtures\Document', |
||||
| 127 | 'alias' => 'Test', |
||||
| 128 | ], |
||||
| 129 | ], |
||||
| 130 | ], |
||||
| 131 | ], |
||||
| 132 | ]); |
||||
| 133 | } |
||||
| 134 | } |
||||
| 135 | |||||
| 136 | protected function configureRoutes(RouteCollectionBuilder $routes): void |
||||
|
0 ignored issues
–
show
The parameter
$routes is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 137 | { |
||||
| 138 | // noop |
||||
| 139 | } |
||||
| 140 | } |
||||
| 141 |