diff --git a/app/composer.lock b/app/composer.lock index 998aacd..ae0d23c 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -127,16 +127,16 @@ }, { "name": "cakephp/core", - "version": "5.1.2", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/cakephp/core.git", - "reference": "70f99f5df4dde8677ddcf6245654a8b937f7786b" + "reference": "fdd2ab323284cc8475decaeaad4a3398aa90ff91" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/core/zipball/70f99f5df4dde8677ddcf6245654a8b937f7786b", - "reference": "70f99f5df4dde8677ddcf6245654a8b937f7786b", + "url": "https://api.github.com/repos/cakephp/core/zipball/fdd2ab323284cc8475decaeaad4a3398aa90ff91", + "reference": "fdd2ab323284cc8475decaeaad4a3398aa90ff91", "shasum": "" }, "require": { @@ -185,20 +185,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/core" }, - "time": "2024-10-31T06:55:29+00:00" + "time": "2024-11-30T18:47:29+00:00" }, { "name": "cakephp/database", - "version": "5.1.2", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/cakephp/database.git", - "reference": "0266cba5968f089cbca8785dbae4450623a6f055" + "reference": "3a872d4ef14424679d30d2045eaca2643c967d64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/database/zipball/0266cba5968f089cbca8785dbae4450623a6f055", - "reference": "0266cba5968f089cbca8785dbae4450623a6f055", + "url": "https://api.github.com/repos/cakephp/database/zipball/3a872d4ef14424679d30d2045eaca2643c967d64", + "reference": "3a872d4ef14424679d30d2045eaca2643c967d64", "shasum": "" }, "require": { @@ -247,20 +247,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/database" }, - "time": "2024-11-02T13:34:55+00:00" + "time": "2024-12-12T13:08:46+00:00" }, { "name": "cakephp/datasource", - "version": "5.1.2", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/cakephp/datasource.git", - "reference": "9ffde854a988cadc740f419b602f9872260908a8" + "reference": "34b9617febd47649011e8914a4dbb21194a78504" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/datasource/zipball/9ffde854a988cadc740f419b602f9872260908a8", - "reference": "9ffde854a988cadc740f419b602f9872260908a8", + "url": "https://api.github.com/repos/cakephp/datasource/zipball/34b9617febd47649011e8914a4dbb21194a78504", + "reference": "34b9617febd47649011e8914a4dbb21194a78504", "shasum": "" }, "require": { @@ -309,20 +309,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/datasource" }, - "time": "2024-10-17T08:33:47+00:00" + "time": "2024-12-12T02:27:02+00:00" }, { "name": "cakephp/utility", - "version": "5.1.2", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/cakephp/utility.git", - "reference": "a1a503e9ef96761242eb260df0e04eb0e068e5cd" + "reference": "943342ca3c0fc3cccb9f789340ff7eb5eceb1839" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/utility/zipball/a1a503e9ef96761242eb260df0e04eb0e068e5cd", - "reference": "a1a503e9ef96761242eb260df0e04eb0e068e5cd", + "url": "https://api.github.com/repos/cakephp/utility/zipball/943342ca3c0fc3cccb9f789340ff7eb5eceb1839", + "reference": "943342ca3c0fc3cccb9f789340ff7eb5eceb1839", "shasum": "" }, "require": { @@ -368,7 +368,7 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/utility" }, - "time": "2024-11-08T14:07:41+00:00" + "time": "2024-11-30T18:47:29+00:00" }, { "name": "dflydev/dot-access-data", @@ -842,11 +842,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev", - "dev-4.x": "4.x-dev", - "dev-3.x": "3.x-dev", + "dev-1.x": "1.x-dev", "dev-2.x": "2.x-dev", - "dev-1.x": "1.x-dev" + "dev-3.x": "3.x-dev", + "dev-4.x": "4.x-dev", + "dev-master": "4.x-dev" } }, "autoload": { @@ -1379,20 +1379,20 @@ }, { "name": "odan/session", - "version": "6.2.0", + "version": "6.3.0", "source": { "type": "git", "url": "https://github.com/odan/session.git", - "reference": "8ff12848b4e115ede1eae7cfd14dc1f891897d57" + "reference": "632366f11acb70cdfdcff1280684584a36d6b59c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/odan/session/zipball/8ff12848b4e115ede1eae7cfd14dc1f891897d57", - "reference": "8ff12848b4e115ede1eae7cfd14dc1f891897d57", + "url": "https://api.github.com/repos/odan/session/zipball/632366f11acb70cdfdcff1280684584a36d6b59c", + "reference": "632366f11acb70cdfdcff1280684584a36d6b59c", "shasum": "" }, "require": { - "php": "8.2.* || 8.3.*", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "psr/http-message": "^1 || ^2", "psr/http-server-handler": "^1", "psr/http-server-middleware": "^1" @@ -1401,7 +1401,7 @@ "friendsofphp/php-cs-fixer": "^3", "middlewares/utils": "^3", "nyholm/psr7": "^1.5", - "phpstan/phpstan": "^1", + "phpstan/phpstan": "^2", "phpunit/phpunit": "^11", "squizlabs/php_codesniffer": "^3" }, @@ -1423,9 +1423,9 @@ ], "support": { "issues": "https://github.com/odan/session/issues", - "source": "https://github.com/odan/session/tree/6.2.0" + "source": "https://github.com/odan/session/tree/6.3.0" }, - "time": "2024-09-20T17:31:55+00:00" + "time": "2024-12-15T13:21:05+00:00" }, { "name": "php-di/invoker", @@ -3299,16 +3299,16 @@ }, { "name": "symfony/console", - "version": "v7.2.0", + "version": "v7.2.1", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "23c8aae6d764e2bae02d2a99f7532a7f6ed619cf" + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/23c8aae6d764e2bae02d2a99f7532a7f6ed619cf", - "reference": "23c8aae6d764e2bae02d2a99f7532a7f6ed619cf", + "url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3", + "reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3", "shasum": "" }, "require": { @@ -3372,7 +3372,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.2.0" + "source": "https://github.com/symfony/console/tree/v7.2.1" }, "funding": [ { @@ -3388,7 +3388,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:24:19+00:00" + "time": "2024-12-11T03:49:26+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3549,8 +3549,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3625,8 +3625,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3703,8 +3703,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3787,8 +3787,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3861,8 +3861,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -3941,8 +3941,8 @@ "type": "library", "extra": { "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { @@ -4169,16 +4169,16 @@ }, { "name": "twig/twig", - "version": "v3.16.0", + "version": "v3.17.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "475ad2dc97d65d8631393e721e7e44fb544f0561" + "reference": "677ef8da6497a03048192aeeb5aa3018e379ac71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/475ad2dc97d65d8631393e721e7e44fb544f0561", - "reference": "475ad2dc97d65d8631393e721e7e44fb544f0561", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/677ef8da6497a03048192aeeb5aa3018e379ac71", + "reference": "677ef8da6497a03048192aeeb5aa3018e379ac71", "shasum": "" }, "require": { @@ -4233,7 +4233,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.16.0" + "source": "https://github.com/twigphp/Twig/tree/v3.17.1" }, "funding": [ { @@ -4245,7 +4245,7 @@ "type": "tidelift" } ], - "time": "2024-11-29T08:27:05+00:00" + "time": "2024-12-12T09:58:10+00:00" }, { "name": "vlucas/phpdotenv", @@ -5033,16 +5033,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.7", + "version": "11.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca" + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca", - "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", + "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", "shasum": "" }, "require": { @@ -5061,7 +5061,7 @@ "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.4.1" + "phpunit/phpunit": "^11.5.0" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -5099,7 +5099,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8" }, "funding": [ { @@ -5107,7 +5107,7 @@ "type": "github" } ], - "time": "2024-10-09T06:21:38+00:00" + "time": "2024-12-11T12:34:27+00:00" }, { "name": "phpunit/php-file-iterator", @@ -5356,16 +5356,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.0", + "version": "11.5.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "0569902506a6c0878930b87ea79ec3b50ea563f7" + "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0569902506a6c0878930b87ea79ec3b50ea563f7", - "reference": "0569902506a6c0878930b87ea79ec3b50ea563f7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2b94d4f2450b9869fa64a46fd8a6a41997aef56a", + "reference": "2b94d4f2450b9869fa64a46fd8a6a41997aef56a", "shasum": "" }, "require": { @@ -5437,7 +5437,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.5.0" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.1" }, "funding": [ { @@ -5453,7 +5453,7 @@ "type": "tidelift" } ], - "time": "2024-12-06T05:57:38+00:00" + "time": "2024-12-11T10:52:48+00:00" }, { "name": "sebastian/cli-parser", @@ -5514,23 +5514,23 @@ }, { "name": "sebastian/code-unit", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268" + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6bb7d09d6623567178cf54126afa9c2310114268", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", "shasum": "" }, "require": { "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { @@ -5559,7 +5559,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" }, "funding": [ { @@ -5567,7 +5567,7 @@ "type": "github" } ], - "time": "2024-07-03T04:44:28+00:00" + "time": "2024-12-12T09:59:06+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -6541,12 +6541,12 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "ext-pdo": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/app/src/Controller/Channel/CreateChannelAction.php b/app/src/Controller/Channel/CreateChannelAction.php index ff279f6..20db8ad 100644 --- a/app/src/Controller/Channel/CreateChannelAction.php +++ b/app/src/Controller/Channel/CreateChannelAction.php @@ -8,14 +8,15 @@ use Slovocast\Controller\Controller; use Psr\Http\Message\ResponseInterface as Response; use Slovocast\Domain\Repository\Channel\ChannelRepositoryInterface; use Slovocast\Domain\Entity\Channel; -use Slovocast\Domain\Entity\User; +use Slovocast\Domain\Repository\User\UserRepositoryInterface; class CreateChannelAction extends Controller { public function __construct( protected SessionInterface $session, protected LoggerInterface $logger, - protected ChannelRepositoryInterface $channelRepository + protected ChannelRepositoryInterface $channelRepository, + protected UserRepositoryInterface $userInterface ) { } public function handle(): Response @@ -31,7 +32,8 @@ class CreateChannelAction extends Controller $formData['explicit'] = $formData['explicit'] === "yes" ? true : false; - $user = User::fromArray($userData); + /** Do we need to get the user object from MySQL here? */ + $user = $this->userInterface->get($userData['id']); $channel = Channel::fromArray($formData); /** diff --git a/app/src/Routes.php b/app/src/Routes.php index a978159..bbb85c2 100644 --- a/app/src/Routes.php +++ b/app/src/Routes.php @@ -3,6 +3,7 @@ namespace Slovocast; use Slim\App; +use Slovocast\Controller\Channel\CreateChannelAction; use Slovocast\Controller\Channel\CreateChannelPage; use Slovocast\Controller\HomePage; use Slovocast\Controller\HealthCheck; @@ -66,6 +67,10 @@ class Routes ->add(FormKeyMiddleware::class) ->add(AuthenticatedMiddleware::class) ->setName('channel-create-page'); + $app->post('/channel/create', CreateChannelAction::class) + ->add(FormKeyMiddleware::class) + ->add(AuthenticatedMiddleware::class) + ->setName("channel-create-action"); } /** diff --git a/app/templates/channel/create.twig b/app/templates/channel/create.twig index 18f38e3..c82177a 100644 --- a/app/templates/channel/create.twig +++ b/app/templates/channel/create.twig @@ -2,7 +2,7 @@ {% block content %}
-
+