llwebsol /
rAPId
| 1 | <?php |
||
| 2 | |||
| 3 | use EasyDb\Events\Event; |
||
|
0 ignored issues
–
show
|
|||
| 4 | |||
| 5 | return [ |
||
| 6 | /** |
||
| 7 | * Enter the configuration for each database your application will use |
||
| 8 | * The key (ie. 'primary') is used to fetch a DB helper with the given |
||
| 9 | * configuration (ie Db::getDB('primary')) |
||
| 10 | */ |
||
| 11 | |||
| 12 | 'primary' => [ |
||
| 13 | 'db_type' => env('DB_TYPE'), |
||
| 14 | 'host' => env('DB_HOST'), |
||
| 15 | 'db_name' => env('DB_NAME'), |
||
| 16 | 'port' => env('DB_PORT'), |
||
| 17 | 'user' => env('DB_USER'), |
||
| 18 | 'password' => env('DB_PASSWORD'), |
||
| 19 | |||
| 20 | // mysql specific: |
||
| 21 | 'unix_socket' => null, |
||
| 22 | 'charset' => 'utf8mb4', |
||
| 23 | |||
| 24 | // sqlsrv specific |
||
| 25 | 'app' => null, |
||
| 26 | 'connection_pooling' => null, |
||
| 27 | 'encrypt' => null, |
||
| 28 | 'failover_partner' => null, |
||
| 29 | 'login_timeout' => null, |
||
| 30 | 'multiple_active_result_sets' => null, |
||
| 31 | 'quoted_id' => null, |
||
| 32 | 'server' => null, |
||
| 33 | 'trace_file' => null, |
||
| 34 | 'trace_on' => null, |
||
| 35 | 'transaction_isolation' => null, |
||
| 36 | 'trust_server_certificate' => null, |
||
| 37 | 'wsid' => null, |
||
| 38 | |||
| 39 | // sqlite specific |
||
| 40 | 'path' => null, |
||
| 41 | ], |
||
| 42 | |||
| 43 | |||
| 44 | /** |
||
| 45 | * Add the fully qualified name |
||
| 46 | * of a class which implements EasyDb\Events\Listener |
||
| 47 | * to any of the following arrays in order to subscribe |
||
| 48 | * to the associated event |
||
| 49 | */ |
||
| 50 | 'listeners' => [ |
||
| 51 | |||
| 52 | Event::ON_ERROR => [], |
||
| 53 | |||
| 54 | Event::BEFORE_QUERY => [], |
||
| 55 | Event::AFTER_QUERY => [], |
||
| 56 | |||
| 57 | // Update and Insert |
||
| 58 | Event::BEFORE_SAVE => [], |
||
| 59 | Event::AFTER_SAVE => [], |
||
| 60 | |||
| 61 | Event::BEFORE_UPDATE => [], |
||
| 62 | Event::AFTER_UPDATE => [], |
||
| 63 | |||
| 64 | Event::BEFORE_INSERT => [], |
||
| 65 | Event::AFTER_INSERT => [], |
||
| 66 | |||
| 67 | Event::BEFORE_DELETE => [], |
||
| 68 | Event::AFTER_DELETE => [] |
||
| 69 | ] |
||
| 70 | ]; |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: