From b4610fc6a8eb4fbec5a979eb4301674415ad577e Mon Sep 17 00:00:00 2001 From: Dave Smith-Hayes Date: Mon, 11 Nov 2024 03:34:57 +0000 Subject: [PATCH] Update lock file, add documentation to the entity, and the ImageRepository --- app/composer.lock | 78 +++++++++---------- app/src/Domain/Entity.php | 8 ++ .../Repository/Image/ImageRepository.php | 14 ++++ 3 files changed, 61 insertions(+), 39 deletions(-) diff --git a/app/composer.lock b/app/composer.lock index 5f167de..d3c679b 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -67,16 +67,16 @@ }, { "name": "cakephp/core", - "version": "5.1.1", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/cakephp/core.git", - "reference": "2cf48ca0177fbf860f6295a0de08d6870a5a93af" + "reference": "70f99f5df4dde8677ddcf6245654a8b937f7786b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/core/zipball/2cf48ca0177fbf860f6295a0de08d6870a5a93af", - "reference": "2cf48ca0177fbf860f6295a0de08d6870a5a93af", + "url": "https://api.github.com/repos/cakephp/core/zipball/70f99f5df4dde8677ddcf6245654a8b937f7786b", + "reference": "70f99f5df4dde8677ddcf6245654a8b937f7786b", "shasum": "" }, "require": { @@ -125,20 +125,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/core" }, - "time": "2024-09-24T13:09:59+00:00" + "time": "2024-10-31T06:55:29+00:00" }, { "name": "cakephp/database", - "version": "5.1.1", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/cakephp/database.git", - "reference": "077377de79298ce61b1e325a7be47bd65ebae0ba" + "reference": "0266cba5968f089cbca8785dbae4450623a6f055" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/database/zipball/077377de79298ce61b1e325a7be47bd65ebae0ba", - "reference": "077377de79298ce61b1e325a7be47bd65ebae0ba", + "url": "https://api.github.com/repos/cakephp/database/zipball/0266cba5968f089cbca8785dbae4450623a6f055", + "reference": "0266cba5968f089cbca8785dbae4450623a6f055", "shasum": "" }, "require": { @@ -187,20 +187,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/database" }, - "time": "2024-10-03T07:25:02+00:00" + "time": "2024-11-02T13:34:55+00:00" }, { "name": "cakephp/datasource", - "version": "5.1.1", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/cakephp/datasource.git", - "reference": "19bdf9d5ba048a3adb1f803391409e1419454f2b" + "reference": "9ffde854a988cadc740f419b602f9872260908a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/datasource/zipball/19bdf9d5ba048a3adb1f803391409e1419454f2b", - "reference": "19bdf9d5ba048a3adb1f803391409e1419454f2b", + "url": "https://api.github.com/repos/cakephp/datasource/zipball/9ffde854a988cadc740f419b602f9872260908a8", + "reference": "9ffde854a988cadc740f419b602f9872260908a8", "shasum": "" }, "require": { @@ -249,20 +249,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/datasource" }, - "time": "2024-09-06T12:23:52+00:00" + "time": "2024-10-17T08:33:47+00:00" }, { "name": "cakephp/utility", - "version": "5.1.1", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/cakephp/utility.git", - "reference": "e40c6ed007e3a9eb5873ca174c2f9160677b5570" + "reference": "a1a503e9ef96761242eb260df0e04eb0e068e5cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/utility/zipball/e40c6ed007e3a9eb5873ca174c2f9160677b5570", - "reference": "e40c6ed007e3a9eb5873ca174c2f9160677b5570", + "url": "https://api.github.com/repos/cakephp/utility/zipball/a1a503e9ef96761242eb260df0e04eb0e068e5cd", + "reference": "a1a503e9ef96761242eb260df0e04eb0e068e5cd", "shasum": "" }, "require": { @@ -308,7 +308,7 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/utility" }, - "time": "2024-09-06T12:23:52+00:00" + "time": "2024-11-08T14:07:41+00:00" }, { "name": "dflydev/dot-access-data", @@ -748,16 +748,16 @@ }, { "name": "league/container", - "version": "4.2.3", + "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/thephpleague/container.git", - "reference": "72f9bebe7bd623007782a40f5ec305661ab706d8" + "reference": "7ea728b013b9a156c409c6f0fc3624071b742dec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/container/zipball/72f9bebe7bd623007782a40f5ec305661ab706d8", - "reference": "72f9bebe7bd623007782a40f5ec305661ab706d8", + "url": "https://api.github.com/repos/thephpleague/container/zipball/7ea728b013b9a156c409c6f0fc3624071b742dec", + "reference": "7ea728b013b9a156c409c6f0fc3624071b742dec", "shasum": "" }, "require": { @@ -818,7 +818,7 @@ ], "support": { "issues": "https://github.com/thephpleague/container/issues", - "source": "https://github.com/thephpleague/container/tree/4.2.3" + "source": "https://github.com/thephpleague/container/tree/4.2.4" }, "funding": [ { @@ -826,7 +826,7 @@ "type": "github" } ], - "time": "2024-10-23T12:06:58+00:00" + "time": "2024-11-10T12:42:13+00:00" }, { "name": "league/flysystem", @@ -4208,16 +4208,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.12.0", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/123267b2c49fbf30d78a7b2d333f6be754b94845", + "reference": "123267b2c49fbf30d78a7b2d333f6be754b94845", "shasum": "" }, "require": { @@ -4256,7 +4256,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.1" }, "funding": [ { @@ -4264,7 +4264,7 @@ "type": "tidelift" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2024-11-08T17:47:46+00:00" }, { "name": "nikic/php-parser", @@ -4561,23 +4561,23 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.9.0", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d" + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/1fb5ba8d045f5dd984ebded5b1cc66f29459422d", - "reference": "1fb5ba8d045f5dd984ebded5b1cc66f29459422d", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/679e3ce485b99e84c775d28e2e96fade9a7fb50a", + "reference": "679e3ce485b99e84c775d28e2e96fade9a7fb50a", "shasum": "" }, "require": { "doctrine/deprecations": "^1.0", "php": "^7.3 || ^8.0", "phpdocumentor/reflection-common": "^2.0", - "phpstan/phpdoc-parser": "^1.18" + "phpstan/phpdoc-parser": "^1.18|^2.0" }, "require-dev": { "ext-tokenizer": "*", @@ -4613,9 +4613,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.9.0" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.10.0" }, - "time": "2024-11-03T20:11:34+00:00" + "time": "2024-11-09T15:12:26+00:00" }, { "name": "phpspec/prophecy", diff --git a/app/src/Domain/Entity.php b/app/src/Domain/Entity.php index ae7875f..8cf7f7a 100644 --- a/app/src/Domain/Entity.php +++ b/app/src/Domain/Entity.php @@ -5,6 +5,14 @@ namespace Slovocast\Domain; use DateTime; use DateTimeImmutable; +/** + * The Entity Trait is standard record based methods and properties that will + * turn any object in a domain into an Entity, by providing it with an ID + * property, setter and getter methods. + * + * If you don't want to be able to set an ID on an object in the Domain, then + * simply override the setter to do nothing. + */ trait Entity { protected ?int $id; diff --git a/app/src/Domain/Repository/Image/ImageRepository.php b/app/src/Domain/Repository/Image/ImageRepository.php index 5e1f003..5e562a1 100644 --- a/app/src/Domain/Repository/Image/ImageRepository.php +++ b/app/src/Domain/Repository/Image/ImageRepository.php @@ -74,7 +74,21 @@ class ImageRepository implements ImageRepositoryInterface public function update(Image $image): bool { + $query = "UPDATE images + SET url = ?, + title = ?, + width = ?, + height = ? + "; + $results = $this->db->getConnection()->exec($query, [ + $image->getUrl(), + $image->getTitle(), + $image->getWidth(), + $image->getHeight(), + ]); + + return $results; } public function delete(Image $image): bool