|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (C) 2018 Gerrit Addiks. |
|
4
|
|
|
* This package (including this file) was released under the terms of the GPL-3.0. |
|
5
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
6
|
|
|
* If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy. |
|
7
|
|
|
* @license GPL-3.0 |
|
8
|
|
|
* @author Gerrit Addiks <[email protected]> |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Addiks\RDMBundle\Mapping\DriverFactories; |
|
12
|
|
|
|
|
13
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
|
14
|
|
|
use Doctrine\Persistence\Mapping\Driver\MappingDriver; |
|
15
|
|
|
use Addiks\RDMBundle\Mapping\DriverFactories\MappingDriverFactoryInterface; |
|
16
|
|
|
use Addiks\RDMBundle\Mapping\Drivers\MappingDriverInterface; |
|
17
|
|
|
use ErrorException; |
|
18
|
|
|
use Doctrine\Bundle\DoctrineBundle\Mapping\MappingDriver as DoctrineBundleMappingDriver; |
|
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Circumvents the symfony "circular reference" error by lazy-loading. |
|
22
|
|
|
*/ |
|
23
|
|
|
final class MappingDriverFactoryLazyLoadProxy implements MappingDriverFactoryInterface |
|
24
|
|
|
{ |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var ContainerInterface |
|
28
|
|
|
*/ |
|
29
|
|
|
private $container; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
private $serviceId; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var ?MappingDriverFactoryInterface |
|
38
|
|
|
*/ |
|
39
|
|
|
private $actualMappingDriverFactory; |
|
40
|
7 |
|
|
|
41
|
|
|
public function __construct(ContainerInterface $container, string $serviceId) |
|
42
|
7 |
|
{ |
|
43
|
7 |
|
$this->container = $container; |
|
44
|
|
|
$this->serviceId = $serviceId; |
|
45
|
|
|
} |
|
46
|
7 |
|
|
|
47
|
|
|
public function createRDMMappingDriver( |
|
48
|
|
|
MappingDriver $mappingDriver |
|
49
|
7 |
|
): ?MappingDriverInterface { |
|
50
|
|
|
if (is_null($this->actualMappingDriverFactory)) { |
|
51
|
7 |
|
/** @var object $actualMappingDriverFactory */ |
|
52
|
7 |
|
$actualMappingDriverFactory = $this->container->get( |
|
53
|
|
|
$this->serviceId, |
|
54
|
|
|
ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE |
|
55
|
|
|
); |
|
56
|
7 |
|
|
|
57
|
7 |
|
if ($actualMappingDriverFactory instanceof MappingDriverFactoryInterface) { |
|
58
|
|
|
$this->actualMappingDriverFactory = $actualMappingDriverFactory; |
|
59
|
|
|
|
|
60
|
|
|
} else { |
|
61
|
|
|
throw new ErrorException(sprintf( |
|
62
|
|
|
"The service '%s' is not an instance of %s!", |
|
63
|
|
|
$this->serviceId, |
|
64
|
|
|
MappingDriverFactoryInterface::class |
|
65
|
|
|
)); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
7 |
|
|
|
69
|
|
|
if ($mappingDriver instanceof DoctrineBundleMappingDriver) { |
|
70
|
|
|
$mappingDriver = $mappingDriver->getDriver(); |
|
|
|
|
|
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
return $this->actualMappingDriverFactory->createRDMMappingDriver($mappingDriver); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
} |
|
77
|
|
|
|
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