Passed
Push — master ( f2e1d1...eea237 )
by Divine Niiquaye
03:30
created

DoctrineOrmExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 19
ccs 0
cts 6
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A loadTypeGuesser() 0 3 1
A loadTypes() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of DivineNii opensource projects.
7
 *
8
 * PHP version 7.4 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 DivineNii (https://divinenii.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Rade\Database\Doctrine\Form;
19
20
use Doctrine\Persistence\ObjectManager;
0 ignored issues
show
Bug introduced by
The type Doctrine\Persistence\ObjectManager was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
use Symfony\Component\Form\AbstractExtension;
22
use Symfony\Component\Form\FormTypeGuesserInterface;
23
24
class DoctrineOrmExtension extends AbstractExtension
25
{
26
    protected ObjectManager $registry;
27
28
    public function __construct(ObjectManager $registry)
29
    {
30
        $this->registry = $registry;
31
    }
32
33
    protected function loadTypes(): array
34
    {
35
        return [
36
            new Type\EntityType($this->registry),
37
        ];
38
    }
39
40
    protected function loadTypeGuesser(): ?FormTypeGuesserInterface
41
    {
42
        return new DoctrineOrmTypeGuesser($this->registry);
43
    }
44
}
45