1 | <?php |
||
2 | |||
3 | /** |
||
4 | * This file is part of orm |
||
5 | * |
||
6 | * For the full copyright and license information, please view the LICENSE |
||
7 | * file that was distributed with this source code. |
||
8 | */ |
||
9 | |||
10 | namespace Slick\Orm\Config\Services; |
||
11 | |||
12 | use Doctrine\DBAL\Connection; |
||
13 | use Doctrine\DBAL\Types\Type; |
||
14 | use Doctrine\ORM\EntityManagerInterface; |
||
15 | use Slick\Configuration\ConfigurationInterface; |
||
16 | use Slick\Di\ContainerInterface; |
||
17 | use Slick\Orm\Infrastructure\Persistence\EntityManagerCollection; |
||
18 | use Slick\Orm\Infrastructure\Persistence\EntityManagerFactory; |
||
0 ignored issues
–
show
|
|||
19 | use Slick\Orm\Infrastructure\Persistence\ManagerSettings; |
||
20 | |||
21 | return [ |
||
22 | EntityManagerFactory::class => fn (ContainerInterface $container) => new EntityManagerFactory($container), |
||
23 | EntityManagerCollection::class => function (ContainerInterface $container) { |
||
24 | $entityManagers = new EntityManagerCollection(); |
||
25 | $settings = $container->get(ConfigurationInterface::class)->get('databases', []); |
||
26 | $factory = $container->get(EntityManagerFactory::class); |
||
27 | foreach ($settings as $name => $values) { |
||
28 | /** @var EntityManagerInterface $entityManager */ |
||
29 | $entityManager = $factory->createManager(new ManagerSettings($values), APP_ROOT); |
||
30 | $entityManagers->add($name, $entityManager); |
||
31 | $container->register("$name.entity.manager", $entityManager); |
||
32 | $container->register("$name.db.connection", $entityManager->getConnection()); |
||
33 | } |
||
34 | $types = $container->get(ConfigurationInterface::class)->get('types', []); |
||
35 | foreach ($types as $name => $className) { |
||
36 | Type::addType($name, $className); |
||
37 | } |
||
38 | return $entityManagers; |
||
39 | }, |
||
40 | EntityManagerInterface::class => fn (ContainerInterface $container) |
||
41 | => $container->get(EntityManagerCollection::class)->get('default'), |
||
42 | Connection::class => fn (ContainerInterface $container) |
||
43 | => $container->get(EntityManagerCollection::class)->get('default')->getConnection() |
||
44 | ]; |
||
45 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths