1 | <?php |
||||
2 | namespace Gvera\Helpers\entities; |
||||
3 | |||||
4 | use Doctrine\Common\Cache\ApcCache; |
||||
5 | use Doctrine\Common\Cache\ArrayCache; |
||||
6 | use Doctrine\Common\EventManager; |
||||
7 | use Doctrine\Common\Cache\RedisCache; |
||||
8 | use Doctrine\DBAL\DBALException; |
||||
0 ignored issues
–
show
|
|||||
9 | use Doctrine\DBAL\DriverManager; |
||||
10 | use Doctrine\DBAL\Exception; |
||||
11 | use Doctrine\ORM\Configuration; |
||||
12 | use Doctrine\ORM\EntityManager; |
||||
13 | use Doctrine\ORM\Exception\MissingMappingDriverImplementation; |
||||
14 | use Gvera\Helpers\config\Config; |
||||
15 | use function PHPUnit\Framework\isEmpty; |
||||
16 | |||||
17 | /** |
||||
18 | * Entities Class Doc Comment |
||||
19 | * |
||||
20 | * @category Class |
||||
21 | * @package src/helpser/entities |
||||
22 | * @author Guido Vera |
||||
23 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License |
||||
24 | * @link http://www.github.com/veraguido/gv |
||||
25 | * |
||||
26 | */ |
||||
27 | class GvEntityManager extends EntityManager |
||||
28 | { |
||||
29 | const PROXIES_PATH = __DIR__ . '/../../../var/proxies/'; |
||||
30 | const MODELS_PATH = __DIR__ . '/../../../src/Models/'; |
||||
31 | const SECONDARY_MODELS_PATH = __DIR__ . '/../../../vendor/gvera/core-entities/src/Models/'; |
||||
32 | |||||
33 | /** |
||||
34 | * @param Config $config |
||||
35 | * @param string|null $modelsPaths |
||||
36 | * @param string|null $secondaryModelsPath |
||||
37 | * @throws Exception |
||||
38 | * @throws MissingMappingDriverImplementation |
||||
39 | */ |
||||
40 | public function __construct(Config $config, $modelsPaths = null, string $secondaryModelsPath = null) |
||||
41 | { |
||||
42 | |||||
43 | $devMode = $config->getConfigItem('devmode'); |
||||
44 | $mysqlConfig = $config->getConfigItem('mysql'); |
||||
45 | $cache = new ArrayCache(); |
||||
0 ignored issues
–
show
The class
Doctrine\Common\Cache\ArrayCache has been deprecated: Deprecated without replacement in doctrine/cache 1.11. This class will be dropped in 2.0
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
46 | if (!$devMode) { |
||||
47 | $cache = new ApcCache(); |
||||
0 ignored issues
–
show
The class
Doctrine\Common\Cache\ApcCache has been deprecated: since version 1.6, use ApcuCache instead
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
48 | } |
||||
49 | |||||
50 | $primaryPath = $modelsPaths ?? self::MODELS_PATH; |
||||
51 | $secondaryPath = $secondaryModelsPath ?? self::SECONDARY_MODELS_PATH; |
||||
52 | |||||
53 | $paths = [$primaryPath, $secondaryPath]; |
||||
54 | |||||
55 | $doctrineConfig = new Configuration(); |
||||
56 | $doctrineConfig->setMetadataCacheImpl($cache); |
||||
0 ignored issues
–
show
The function
Doctrine\ORM\Configuration::setMetadataCacheImpl() has been deprecated: Deprecated in favor of setMetadataCache
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
57 | $driverImpl = $doctrineConfig->newDefaultAnnotationDriver($paths); |
||||
0 ignored issues
–
show
The function
Doctrine\ORM\Configurati...faultAnnotationDriver() has been deprecated: Use {@see ORMSetup::createDefaultAnnotationDriver()} instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
58 | $doctrineConfig->setMetadataDriverImpl($driverImpl); |
||||
59 | $doctrineConfig->setQueryCacheImpl($cache); |
||||
0 ignored issues
–
show
The function
Doctrine\ORM\Configuration::setQueryCacheImpl() has been deprecated: Call {@see setQueryCache()} instead.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
60 | $doctrineConfig->setProxyDir(self::PROXIES_PATH); |
||||
61 | $doctrineConfig->setProxyNamespace('Gvera\Models'); |
||||
62 | |||||
63 | $doctrineConfig->setAutoGenerateProxyClasses($devMode); |
||||
64 | $dbParams = array( |
||||
65 | 'driver' => $mysqlConfig['driver'], |
||||
66 | 'host' => $mysqlConfig['host'], |
||||
67 | 'user' => $mysqlConfig['username'], |
||||
68 | 'password' => $mysqlConfig['password'], |
||||
69 | 'dbname' => $mysqlConfig['db_name'] |
||||
70 | ); |
||||
71 | |||||
72 | |||||
73 | $connection = DriverManager::getConnection($dbParams, $doctrineConfig); |
||||
74 | parent::__construct($connection, $doctrineConfig); |
||||
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