EntityManagerAliasCompatFactory::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineORMModule\Service;
6
7
use Doctrine\ORM\EntityManager;
8
use Interop\Container\ContainerInterface;
9
use Laminas\ServiceManager\FactoryInterface;
10
use Laminas\ServiceManager\ServiceLocatorInterface;
11
12
/**
13
 * Factory that provides the `Doctrine\ORM\EntityManager` alias for `doctrine.entitymanager.orm_default`
14
 */
15
class EntityManagerAliasCompatFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Laminas\ServiceManager\FactoryInterface has been deprecated with message: Use Laminas\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
16
{
17
    /**
18
     * {@inheritDoc}
19
     *
20
     * @deprecated this method was introduced to allow aliasing of service `Doctrine\ORM\EntityManager`
21
     *             from `doctrine.entitymanager.orm_default`
22
     *
23
     * @return EntityManager
24
     */
25
    public function __invoke(ContainerInterface $container, $requestedName, ?array $options = null)
26
    {
27
        return $container->get('doctrine.entitymanager.orm_default');
28
    }
29
30
    /**
31
     * {@inheritDoc}
32
     *
33
     * @deprecated this method was introduced to allow aliasing of service `Doctrine\ORM\EntityManager`
34
     *             from `doctrine.entitymanager.orm_default`
35
     *
36
     * @return EntityManager
37
     */
38
    public function createService(ServiceLocatorInterface $container)
39
    {
40
        return $this($container, EntityManager::class);
41
    }
42
}
43