Remove our own database interfaces, start using the FOR MySQL library.

This commit is contained in:
Dave Smith-Hayes 2024-06-26 21:40:34 -04:00
parent 128a1e7518
commit e904b27017
5 changed files with 125 additions and 160 deletions

204
app/composer.lock generated
View File

@ -63,16 +63,16 @@
},
{
"name": "cakephp/core",
"version": "5.0.8",
"version": "5.0.9",
"source": {
"type": "git",
"url": "https://github.com/cakephp/core.git",
"reference": "163ba348b96870de24b7cf34abdcd8d0c3794ed7"
"reference": "63a873e41a5ec74e00d1321b533e26c2631eeca5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/core/zipball/163ba348b96870de24b7cf34abdcd8d0c3794ed7",
"reference": "163ba348b96870de24b7cf34abdcd8d0c3794ed7",
"url": "https://api.github.com/repos/cakephp/core/zipball/63a873e41a5ec74e00d1321b533e26c2631eeca5",
"reference": "63a873e41a5ec74e00d1321b533e26c2631eeca5",
"shasum": ""
},
"require": {
@ -121,20 +121,20 @@
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/core"
},
"time": "2024-03-13T17:13:27+00:00"
"time": "2024-06-08T17:54:49+00:00"
},
{
"name": "cakephp/database",
"version": "5.0.8",
"version": "5.0.9",
"source": {
"type": "git",
"url": "https://github.com/cakephp/database.git",
"reference": "d8836c256e596e8cefdbc0d997eea11ecc751b27"
"reference": "61042e3b086689ee3bee88792250e51da370eaec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/database/zipball/d8836c256e596e8cefdbc0d997eea11ecc751b27",
"reference": "d8836c256e596e8cefdbc0d997eea11ecc751b27",
"url": "https://api.github.com/repos/cakephp/database/zipball/61042e3b086689ee3bee88792250e51da370eaec",
"reference": "61042e3b086689ee3bee88792250e51da370eaec",
"shasum": ""
},
"require": {
@ -184,20 +184,20 @@
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/database"
},
"time": "2024-04-19T15:02:43+00:00"
"time": "2024-06-08T07:44:07+00:00"
},
{
"name": "cakephp/datasource",
"version": "5.0.8",
"version": "5.0.9",
"source": {
"type": "git",
"url": "https://github.com/cakephp/datasource.git",
"reference": "3b3a70d0d8ae0daf55535f45b99ef109639ed1ec"
"reference": "28b8ce86ef77bd45fef7ba9ad31f03bf2fa81fa5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/datasource/zipball/3b3a70d0d8ae0daf55535f45b99ef109639ed1ec",
"reference": "3b3a70d0d8ae0daf55535f45b99ef109639ed1ec",
"url": "https://api.github.com/repos/cakephp/datasource/zipball/28b8ce86ef77bd45fef7ba9ad31f03bf2fa81fa5",
"reference": "28b8ce86ef77bd45fef7ba9ad31f03bf2fa81fa5",
"shasum": ""
},
"require": {
@ -247,20 +247,20 @@
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/datasource"
},
"time": "2024-03-11T18:07:04+00:00"
"time": "2024-05-24T02:41:11+00:00"
},
{
"name": "cakephp/utility",
"version": "5.0.8",
"version": "5.0.9",
"source": {
"type": "git",
"url": "https://github.com/cakephp/utility.git",
"reference": "6d624cefc3e005ebf9bd2e7d8a1d35f5f4601ff8"
"reference": "6ddf7ad73bb6f7aeb303b19baff4b1e5a5d02cb5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cakephp/utility/zipball/6d624cefc3e005ebf9bd2e7d8a1d35f5f4601ff8",
"reference": "6d624cefc3e005ebf9bd2e7d8a1d35f5f4601ff8",
"url": "https://api.github.com/repos/cakephp/utility/zipball/6ddf7ad73bb6f7aeb303b19baff4b1e5a5d02cb5",
"reference": "6ddf7ad73bb6f7aeb303b19baff4b1e5a5d02cb5",
"shasum": ""
},
"require": {
@ -306,7 +306,7 @@
"issues": "https://github.com/cakephp/cakephp/issues",
"source": "https://github.com/cakephp/utility"
},
"time": "2024-02-24T04:42:47+00:00"
"time": "2024-06-23T00:10:36+00:00"
},
{
"name": "dflydev/dot-access-data",
@ -3016,40 +3016,40 @@
},
{
"name": "slim/psr7",
"version": "1.6.1",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim-Psr7.git",
"reference": "72d2b2bac94ab4575d369f605dbfafbe168d3163"
"reference": "753e9646def5ff4db1a06e5cf4ef539bfd30f467"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/72d2b2bac94ab4575d369f605dbfafbe168d3163",
"reference": "72d2b2bac94ab4575d369f605dbfafbe168d3163",
"url": "https://api.github.com/repos/slimphp/Slim-Psr7/zipball/753e9646def5ff4db1a06e5cf4ef539bfd30f467",
"reference": "753e9646def5ff4db1a06e5cf4ef539bfd30f467",
"shasum": ""
},
"require": {
"fig/http-message-util": "^1.1.5",
"php": "^7.4 || ^8.0",
"psr/http-factory": "^1.0",
"psr/http-message": "^1.0",
"php": "^8.0",
"psr/http-factory": "^1.1",
"psr/http-message": "^1.0 || ^2.0",
"ralouphie/getallheaders": "^3.0",
"symfony/polyfill-php80": "^1.26"
"symfony/polyfill-php80": "^1.29"
},
"provide": {
"psr/http-factory-implementation": "1.0",
"psr/http-message-implementation": "1.0"
"psr/http-factory-implementation": "^1.0",
"psr/http-message-implementation": "^1.0 || ^2.0"
},
"require-dev": {
"adriansuter/php-autoload-override": "^1.3",
"adriansuter/php-autoload-override": "^1.4",
"ext-json": "*",
"http-interop/http-factory-tests": "^0.9.0",
"php-http/psr7-integration-tests": "1.1",
"phpspec/prophecy": "^1.15",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^1.8",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7"
"http-interop/http-factory-tests": "^1.1.0",
"php-http/psr7-integration-tests": "1.3.0",
"phpspec/prophecy": "^1.19",
"phpspec/prophecy-phpunit": "^2.2",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.10"
},
"type": "library",
"autoload": {
@ -3092,22 +3092,22 @@
],
"support": {
"issues": "https://github.com/slimphp/Slim-Psr7/issues",
"source": "https://github.com/slimphp/Slim-Psr7/tree/1.6.1"
"source": "https://github.com/slimphp/Slim-Psr7/tree/1.7.0"
},
"time": "2023-04-17T16:02:20+00:00"
"time": "2024-06-08T14:48:17+00:00"
},
{
"name": "slim/slim",
"version": "4.13.0",
"version": "4.14.0",
"source": {
"type": "git",
"url": "https://github.com/slimphp/Slim.git",
"reference": "038fd5713d5a41636fdff0e8dcceedecdd17fc17"
"reference": "5943393b88716eb9e82c4161caa956af63423913"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/038fd5713d5a41636fdff0e8dcceedecdd17fc17",
"reference": "038fd5713d5a41636fdff0e8dcceedecdd17fc17",
"url": "https://api.github.com/repos/slimphp/Slim/zipball/5943393b88716eb9e82c4161caa956af63423913",
"reference": "5943393b88716eb9e82c4161caa956af63423913",
"shasum": ""
},
"require": {
@ -3115,7 +3115,7 @@
"nikic/fast-route": "^1.3",
"php": "^7.4 || ^8.0",
"psr/container": "^1.0 || ^2.0",
"psr/http-factory": "^1.0",
"psr/http-factory": "^1.1",
"psr/http-message": "^1.1 || ^2.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
@ -3132,11 +3132,12 @@
"nyholm/psr7-server": "^1.1",
"phpspec/prophecy": "^1.19",
"phpspec/prophecy-phpunit": "^2.1",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^9.6",
"slim/http": "^1.3",
"slim/psr7": "^1.6",
"squizlabs/php_codesniffer": "^3.9"
"squizlabs/php_codesniffer": "^3.10",
"vimeo/psalm": "^5.24"
},
"suggest": {
"ext-simplexml": "Needed to support XML format in BodyParsingMiddleware",
@ -3209,7 +3210,7 @@
"type": "tidelift"
}
],
"time": "2024-03-03T21:25:30+00:00"
"time": "2024-06-13T08:54:48+00:00"
},
{
"name": "slim/twig-view",
@ -3579,16 +3580,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.29.0",
"version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
"reference": "0424dff1c58f028c451efff2045f5d92410bd540"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540",
"shasum": ""
},
"require": {
@ -3638,7 +3639,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0"
},
"funding": [
{
@ -3654,7 +3655,7 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-05-31T15:07:36+00:00"
},
{
"name": "symfony/polyfill-intl-grapheme",
@ -3817,16 +3818,16 @@
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.29.0",
"version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec"
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c",
"shasum": ""
},
"require": {
@ -3877,7 +3878,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0"
},
"funding": [
{
@ -3893,20 +3894,20 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-06-19T12:30:46+00:00"
},
{
"name": "symfony/polyfill-php80",
"version": "v1.29.0",
"version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b"
"reference": "77fa7995ac1b21ab60769b7323d600a991a90433"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
"reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433",
"reference": "77fa7995ac1b21ab60769b7323d600a991a90433",
"shasum": ""
},
"require": {
@ -3957,7 +3958,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0"
},
"funding": [
{
@ -3973,20 +3974,20 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-05-31T15:07:36+00:00"
},
{
"name": "symfony/polyfill-php81",
"version": "v1.29.0",
"version": "v1.30.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php81.git",
"reference": "c565ad1e63f30e7477fc40738343c62b40bc672d"
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/c565ad1e63f30e7477fc40738343c62b40bc672d",
"reference": "c565ad1e63f30e7477fc40738343c62b40bc672d",
"url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af",
"reference": "3fb075789fb91f9ad9af537c4012d523085bd5af",
"shasum": ""
},
"require": {
@ -4033,7 +4034,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php81/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0"
},
"funding": [
{
@ -4049,7 +4050,7 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-06-19T12:30:46+00:00"
},
{
"name": "symfony/service-contracts",
@ -4505,16 +4506,16 @@
},
{
"name": "myclabs/deep-copy",
"version": "1.11.1",
"version": "1.12.0",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c"
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"reference": "7284c22080590fb39f2ffa3e9057f10a4ddd0e0c",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c",
"shasum": ""
},
"require": {
@ -4522,11 +4523,12 @@
},
"conflict": {
"doctrine/collections": "<1.6.8",
"doctrine/common": "<2.13.3 || >=3,<3.2.2"
"doctrine/common": "<2.13.3 || >=3 <3.2.2"
},
"require-dev": {
"doctrine/collections": "^1.6.8",
"doctrine/common": "^2.13.3 || ^3.2.2",
"phpspec/prophecy": "^1.10",
"phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
},
"type": "library",
@ -4552,7 +4554,7 @@
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.11.1"
"source": "https://github.com/myclabs/DeepCopy/tree/1.12.0"
},
"funding": [
{
@ -4560,7 +4562,7 @@
"type": "tidelift"
}
],
"time": "2023-03-08T13:26:56+00:00"
"time": "2024-06-12T14:39:25+00:00"
},
{
"name": "nikic/php-parser",
@ -5406,16 +5408,16 @@
},
{
"name": "phpunit/phpunit",
"version": "11.1.3",
"version": "11.2.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d475be032238173ca3b0a516f5cc291d174708ae"
"reference": "be9e3ed32a1287a9bfda15936cc86fef4e4cf591"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d475be032238173ca3b0a516f5cc291d174708ae",
"reference": "d475be032238173ca3b0a516f5cc291d174708ae",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/be9e3ed32a1287a9bfda15936cc86fef4e4cf591",
"reference": "be9e3ed32a1287a9bfda15936cc86fef4e4cf591",
"shasum": ""
},
"require": {
@ -5439,7 +5441,7 @@
"sebastian/comparator": "^6.0",
"sebastian/diff": "^6.0",
"sebastian/environment": "^7.0",
"sebastian/exporter": "^6.0",
"sebastian/exporter": "^6.1.2",
"sebastian/global-state": "^7.0",
"sebastian/object-enumerator": "^6.0",
"sebastian/type": "^5.0",
@ -5454,7 +5456,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "11.1-dev"
"dev-main": "11.2-dev"
}
},
"autoload": {
@ -5486,7 +5488,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.1.3"
"source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.5"
},
"funding": [
{
@ -5502,7 +5504,7 @@
"type": "tidelift"
}
],
"time": "2024-04-24T06:34:25+00:00"
"time": "2024-06-20T13:11:31+00:00"
},
{
"name": "sebastian/cli-parser",
@ -5942,16 +5944,16 @@
},
{
"name": "sebastian/exporter",
"version": "6.0.1",
"version": "6.1.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da"
"reference": "507d2333cbc4e6ea248fbda2d45ee1511e03da13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/f291e5a317c321c0381fa9ecc796fa2d21b186da",
"reference": "f291e5a317c321c0381fa9ecc796fa2d21b186da",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/507d2333cbc4e6ea248fbda2d45ee1511e03da13",
"reference": "507d2333cbc4e6ea248fbda2d45ee1511e03da13",
"shasum": ""
},
"require": {
@ -5960,12 +5962,12 @@
"sebastian/recursion-context": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "^11.0"
"phpunit/phpunit": "^11.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
"dev-main": "6.1-dev"
}
},
"autoload": {
@ -6008,7 +6010,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"security": "https://github.com/sebastianbergmann/exporter/security/policy",
"source": "https://github.com/sebastianbergmann/exporter/tree/6.0.1"
"source": "https://github.com/sebastianbergmann/exporter/tree/6.1.2"
},
"funding": [
{
@ -6016,7 +6018,7 @@
"type": "github"
}
],
"time": "2024-03-02T07:28:20+00:00"
"time": "2024-06-18T11:19:56+00:00"
},
{
"name": "sebastian/global-state",
@ -6254,16 +6256,16 @@
},
{
"name": "sebastian/recursion-context",
"version": "6.0.0",
"version": "6.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4"
"reference": "2f15508e17af4ea35129bbc32ce28a814d9c7426"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b75224967b5a466925c6d54e68edd0edf8dd4ed4",
"reference": "b75224967b5a466925c6d54e68edd0edf8dd4ed4",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2f15508e17af4ea35129bbc32ce28a814d9c7426",
"reference": "2f15508e17af4ea35129bbc32ce28a814d9c7426",
"shasum": ""
},
"require": {
@ -6306,7 +6308,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"security": "https://github.com/sebastianbergmann/recursion-context/security/policy",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.0"
"source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.1"
},
"funding": [
{
@ -6314,7 +6316,7 @@
"type": "github"
}
],
"time": "2024-02-02T06:08:48+00:00"
"time": "2024-06-17T05:22:57+00:00"
},
{
"name": "sebastian/type",

View File

@ -29,12 +29,10 @@ use Slovocast\Domain\Repository\{
UserRepositoryInterface,
UserRepository
};
use Slovocast\Infrastructure\{
DatabaseConnectionInterface,
PdoDatabaseConnection,
User\UserAuthorizationInterface,
User\BasicUserAuthorization
};
use Slovocast\Infrastructure\User\UserAuthorizationInterface;
use Slovocast\Infrastructure\User\BasicUserAuthorization;
use React\Mysql\MysqlClient;
use Psr\Log\LoggerInterface;
use Monolog\Logger;
@ -139,21 +137,18 @@ class Bootstrap
/**
* Database Connections
*/
DatabaseConnectionInterface::class => function(ContainerInterface $container) {
$databaseConfig = $container->get('config')->get('database');
$dsn = sprintf(
"%s:dbname=%s;host=%s",
$databaseConfig['driver'],
$databaseConfig['database'],
$databaseConfig['host']
MysqlClient::class => function (ContainerInterface $container) {
$config = $container->get('config')->get('database');
$connectionString = sprintf(
"%s:%s@%s/%s",
$config['username'],
$config['password'],
$config['host'],
$config['database']
);
$username = $databaseConfig['username'];
$password = $databaseConfig['password'];
$connection = new PdoDatabaseConnection($dsn, $username, $password);
return $connection;
return new MysqlClient($connectionString);
},
/**
* Utility classes
*/
@ -166,7 +161,7 @@ class Bootstrap
*/
UserRepositoryInterface::class => function (ContainerInterface $container) {
return new UserRepository(
$container->get(DatabaseConnectionInterface::class),
$container->get(MysqlClient::class),
$container->get(UserAuthorizationInterface::class)
);
}

View File

@ -2,7 +2,8 @@
namespace Slovocast\Domain\Repository;
use Slovocast\Infrastructure\DatabaseConnectionInterface;
use React\Mysql\MysqlClient;
use React\Mysql\MysqlResult;
use Slovocast\Infrastructure\User\UserAuthorizationInterface;
use Slovocast\Exception\EntityNotFoundException;
use Slovocast\Domain\Entity\User;
@ -11,7 +12,7 @@ use PDO;
class UserRepository implements UserRepositoryInterface
{
public function __construct(
private DatabaseConnectionInterface $database,
private MysqlClient $db,
private UserAuthorizationInterface $userAuth
) {}
@ -91,6 +92,10 @@ class UserRepository implements UserRepositoryInterface
return $this->userFromQueryResults($userData);
}
/**
* @param User $user
* @return bool True if the User is saved.
*/
public function save(User $user): bool
{
$connection = $this->database->getConnection();

View File

@ -1,12 +0,0 @@
<?php
namespace Slovocast\Infrastructure;
/**
* Represents an active connection to the Database through the PDO. Unlike a
* pool, these connections don't need to be returned.
*/
interface DatabaseConnectionInterface
{
public function getName(): string;
}

View File

@ -1,25 +0,0 @@
<?php
namespace Slovocast\Infrastructure;
use PDO;
use Slovocast\Infrastructure\DatabaseConnectionInterface;
/**
* Represents an active connection to a database
*/
class PdoDatabaseConnection extends PDO
implements DatabaseConnectionInterface
{
protected string $name;
public function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
}