1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Dbal\Connection\ConnectionFactory |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2021 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-dbal |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Dbal\Connection; |
22
|
|
|
|
23
|
|
|
use TechDivision\Import\Configuration\ConfigurationInterface; |
|
|
|
|
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* The connection factory implementation. |
27
|
|
|
* |
28
|
|
|
* @author Tim Wagner <[email protected]> |
29
|
|
|
* @copyright 2021 TechDivision GmbH <[email protected]> |
30
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
31
|
|
|
* @link https://github.com/techdivision/import-dbal |
32
|
|
|
* @link http://www.techdivision.com |
33
|
|
|
*/ |
34
|
|
|
class ConnectionFactory |
35
|
|
|
{ |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Create's and return's the connection to use. |
39
|
|
|
* |
40
|
|
|
* @param \TechDivision\Import\Dbal\Configuration\ConfigurationInterface $configuration The configuration with the data to create the connection with |
41
|
|
|
* |
42
|
|
|
* @return \TechDivision\Import\Connection\PDOConnectionWrapper The initialized connection |
|
|
|
|
43
|
|
|
*/ |
44
|
|
|
public static function createConnection(ConfigurationInterface $configuration) |
45
|
|
|
{ |
46
|
|
|
|
47
|
|
|
// initialize the PDO connection |
48
|
|
|
$dsn = $configuration->getDatabase()->getDsn(); |
49
|
|
|
$username = $configuration->getDatabase()->getUsername(); |
50
|
|
|
$password = $configuration->getDatabase()->getPassword(); |
51
|
|
|
$connection = new \PDO($dsn, $username, $password); |
52
|
|
|
$connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); |
53
|
|
|
|
54
|
|
|
/* As of MySQL version > 5.7.4 the ONLY_FULL_GROUP_BY is activated by default. So in some */ |
55
|
|
|
/* cases it is necessary to activate to TRADITIONAL mode to allow certain queries to run, */ |
56
|
|
|
/* https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by */ |
57
|
|
|
$connection->exec('SET SESSION sql_mode = traditional'); |
58
|
|
|
|
59
|
|
|
// reurn the wrapped PDO connection |
60
|
|
|
return new PDOConnectionWrapper($connection); |
|
|
|
|
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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