From 1add437f6b55e00742dc6cf0531d2174ac987a94 Mon Sep 17 00:00:00 2001 From: Lee Peuker Date: Wed, 13 Jul 2022 08:26:30 +0200 Subject: [PATCH] Use tmdb iso 693 language mapping --- composer.json | 3 +- composer.lock | 187 +++++++----------- src/Api/Tmdb/Api.php | 17 ++ src/Application/Movie/Api.php | 8 +- .../Movie/History/Service/Select.php | 6 +- src/Application/Movie/Repository.php | 2 +- 6 files changed, 99 insertions(+), 124 deletions(-) diff --git a/composer.json b/composer.json index 0f87741f..566a8c98 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,6 @@ "doctrine/dbal": "^3.3", "guzzlehttp/guzzle": "^7.4", "league/csv": "^9.8", - "matriphe/iso-639": "^1.2", "monolog/monolog": "^2.4", "nikic/fast-route": "^1.3", "php-di/php-di": "^6.3", @@ -25,7 +24,7 @@ "vlucas/phpdotenv": "^5.4" }, "require-dev": { - "roave/security-advisories": "dev-master", + "roave/security-advisories": "dev-latest", "squizlabs/php_codesniffer": "^3.6", "phpstan/phpstan": "^1.5", "vimeo/psalm": "^4.22" diff --git a/composer.lock b/composer.lock index dc956798..ed12d7c7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9e847425554061e714257fb81af64eff", + "content-hash": "663f52443d10378c65f8813150b20c43", "packages": [ { "name": "brick/math", @@ -68,7 +68,7 @@ }, { "name": "cakephp/core", - "version": "4.4.1", + "version": "4.4.2", "source": { "type": "git", "url": "https://github.com/cakephp/core.git", @@ -125,16 +125,16 @@ }, { "name": "cakephp/database", - "version": "4.4.1", + "version": "4.4.2", "source": { "type": "git", "url": "https://github.com/cakephp/database.git", - "reference": "9bb8b691f36729fd630118a1cc7b52f9ae13d126" + "reference": "61b147195a5899a9b51989af9150a13b647e9190" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/database/zipball/9bb8b691f36729fd630118a1cc7b52f9ae13d126", - "reference": "9bb8b691f36729fd630118a1cc7b52f9ae13d126", + "url": "https://api.github.com/repos/cakephp/database/zipball/61b147195a5899a9b51989af9150a13b647e9190", + "reference": "61b147195a5899a9b51989af9150a13b647e9190", "shasum": "" }, "require": { @@ -176,20 +176,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/database" }, - "time": "2022-04-12T01:11:53+00:00" + "time": "2022-06-20T14:25:54+00:00" }, { "name": "cakephp/datasource", - "version": "4.4.1", + "version": "4.4.2", "source": { "type": "git", "url": "https://github.com/cakephp/datasource.git", - "reference": "3a3e3fcd171f8b90fee8a614b53d913114e4fc09" + "reference": "41b4243d226fc802e1075247c81c8bc48fad4343" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/datasource/zipball/3a3e3fcd171f8b90fee8a614b53d913114e4fc09", - "reference": "3a3e3fcd171f8b90fee8a614b53d913114e4fc09", + "url": "https://api.github.com/repos/cakephp/datasource/zipball/41b4243d226fc802e1075247c81c8bc48fad4343", + "reference": "41b4243d226fc802e1075247c81c8bc48fad4343", "shasum": "" }, "require": { @@ -234,20 +234,20 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/datasource" }, - "time": "2022-06-10T21:39:25+00:00" + "time": "2022-06-27T10:55:08+00:00" }, { "name": "cakephp/utility", - "version": "4.4.1", + "version": "4.4.2", "source": { "type": "git", "url": "https://github.com/cakephp/utility.git", - "reference": "b2a47e038954432b2e09d3406559a75656ebe131" + "reference": "564cf3bea3bb31e0cb53fa199c39f17105af01ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/utility/zipball/b2a47e038954432b2e09d3406559a75656ebe131", - "reference": "b2a47e038954432b2e09d3406559a75656ebe131", + "url": "https://api.github.com/repos/cakephp/utility/zipball/564cf3bea3bb31e0cb53fa199c39f17105af01ec", + "reference": "564cf3bea3bb31e0cb53fa199c39f17105af01ec", "shasum": "" }, "require": { @@ -293,7 +293,7 @@ "issues": "https://github.com/cakephp/cakephp/issues", "source": "https://github.com/cakephp/utility" }, - "time": "2022-05-20T04:16:49+00:00" + "time": "2022-07-05T07:59:19+00:00" }, { "name": "doctrine/cache", @@ -1164,54 +1164,6 @@ ], "time": "2022-01-04T00:13:07+00:00" }, - { - "name": "matriphe/iso-639", - "version": "1.2", - "source": { - "type": "git", - "url": "https://github.com/matriphe/php-iso-639.git", - "reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/matriphe/php-iso-639/zipball/0245d844daeefdd22a54b47103ffdb0e03c323e1", - "reference": "0245d844daeefdd22a54b47103ffdb0e03c323e1", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "^4.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "Matriphe\\ISO639\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Muhammad Zamroni", - "email": "halo@matriphe.com" - } - ], - "description": "PHP library to convert ISO-639-1 code to language name.", - "keywords": [ - "639", - "iso", - "iso-639", - "lang", - "language", - "laravel" - ], - "support": { - "issues": "https://github.com/matriphe/php-iso-639/issues", - "source": "https://github.com/matriphe/php-iso-639/tree/master" - }, - "time": "2017-07-19T15:11:19+00:00" - }, { "name": "monolog/monolog", "version": "2.7.0", @@ -2187,16 +2139,16 @@ }, { "name": "robmorgan/phinx", - "version": "0.12.10", + "version": "0.12.11", "source": { "type": "git", "url": "https://github.com/cakephp/phinx.git", - "reference": "ad056cff354fc67fedf9bf96c441c2b428afad0c" + "reference": "2046c447b1a4425956555118200138e22ebd680c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/phinx/zipball/ad056cff354fc67fedf9bf96c441c2b428afad0c", - "reference": "ad056cff354fc67fedf9bf96c441c2b428afad0c", + "url": "https://api.github.com/repos/cakephp/phinx/zipball/2046c447b1a4425956555118200138e22ebd680c", + "reference": "2046c447b1a4425956555118200138e22ebd680c", "shasum": "" }, "require": { @@ -2267,9 +2219,9 @@ ], "support": { "issues": "https://github.com/cakephp/phinx/issues", - "source": "https://github.com/cakephp/phinx/tree/0.12.10" + "source": "https://github.com/cakephp/phinx/tree/0.12.11" }, - "time": "2022-01-21T19:53:14+00:00" + "time": "2022-07-03T16:41:43+00:00" }, { "name": "symfony/config", @@ -2350,16 +2302,16 @@ }, { "name": "symfony/console", - "version": "v6.1.1", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6187424023fbffcd757789aeb517c9161b1eabee" + "reference": "7a86c1c42fbcb69b59768504c7bca1d3767760b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6187424023fbffcd757789aeb517c9161b1eabee", - "reference": "6187424023fbffcd757789aeb517c9161b1eabee", + "url": "https://api.github.com/repos/symfony/console/zipball/7a86c1c42fbcb69b59768504c7bca1d3767760b7", + "reference": "7a86c1c42fbcb69b59768504c7bca1d3767760b7", "shasum": "" }, "require": { @@ -2426,7 +2378,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.1.1" + "source": "https://github.com/symfony/console/tree/v6.1.2" }, "funding": [ { @@ -2442,11 +2394,11 @@ "type": "tidelift" } ], - "time": "2022-06-08T14:02:09+00:00" + "time": "2022-06-26T13:01:30+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.1.0", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", @@ -2493,7 +2445,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.1.1" }, "funding": [ { @@ -3068,16 +3020,16 @@ }, { "name": "symfony/service-contracts", - "version": "v2.5.1", + "version": "v2.5.2", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", - "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", "shasum": "" }, "require": { @@ -3131,7 +3083,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.2" }, "funding": [ { @@ -3147,20 +3099,20 @@ "type": "tidelift" } ], - "time": "2022-03-13T20:07:29+00:00" + "time": "2022-05-30T19:17:29+00:00" }, { "name": "symfony/string", - "version": "v6.1.0", + "version": "v6.1.2", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529" + "reference": "1903f2879875280c5af944625e8246d81c2f0604" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d3edc75baf9f1d4f94879764dda2e1ac33499529", - "reference": "d3edc75baf9f1d4f94879764dda2e1ac33499529", + "url": "https://api.github.com/repos/symfony/string/zipball/1903f2879875280c5af944625e8246d81c2f0604", + "reference": "1903f2879875280c5af944625e8246d81c2f0604", "shasum": "" }, "require": { @@ -3216,7 +3168,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.1.0" + "source": "https://github.com/symfony/string/tree/v6.1.2" }, "funding": [ { @@ -3232,7 +3184,7 @@ "type": "tidelift" } ], - "time": "2022-04-22T08:18:23+00:00" + "time": "2022-06-26T16:35:04+00:00" }, { "name": "twig/twig", @@ -4309,16 +4261,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.7.15", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "cd0202ea1b1fc6d1bbe156c6e2e18a03e0ff160a" + "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/cd0202ea1b1fc6d1bbe156c6e2e18a03e0ff160a", - "reference": "cd0202ea1b1fc6d1bbe156c6e2e18a03e0ff160a", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8dbba631fa32f4b289404469c2afd6122fd61d67", + "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67", "shasum": "" }, "require": { @@ -4344,7 +4296,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.7.15" + "source": "https://github.com/phpstan/phpstan/tree/1.8.1" }, "funding": [ { @@ -4364,20 +4316,20 @@ "type": "tidelift" } ], - "time": "2022-06-20T08:29:01+00:00" + "time": "2022-07-12T16:08:06+00:00" }, { "name": "roave/security-advisories", - "version": "dev-master", + "version": "dev-latest", "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "880f953435f266cf634bb81fa8888e66fa7814f6" + "reference": "142c350dd23588666546a92de0d4cd4cafdad2c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/880f953435f266cf634bb81fa8888e66fa7814f6", - "reference": "880f953435f266cf634bb81fa8888e66fa7814f6", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/142c350dd23588666546a92de0d4cd4cafdad2c5", + "reference": "142c350dd23588666546a92de0d4cd4cafdad2c5", "shasum": "" }, "conflict": { @@ -4430,7 +4382,7 @@ "codiad/codiad": "<=2.8.4", "composer/composer": "<1.10.26|>=2-alpha.1,<2.2.12|>=2.3,<2.3.5", "concrete5/concrete5": "<9", - "concrete5/core": "<8.5.7", + "concrete5/core": "<8.5.8|>=9,<9.1", "contao-components/mediaelement": ">=2.14.2,<2.21.1", "contao/contao": ">=4,<4.4.56|>=4.5,<4.9.18|>=4.10,<4.11.7|>=4.13,<4.13.3", "contao/core": ">=2,<3.5.39", @@ -4439,7 +4391,7 @@ "contao/managed-edition": "<=1.5", "craftcms/cms": "<3.7.36", "croogo/croogo": "<3.0.7", - "cuyz/valinor": ">=0.5,<0.7", + "cuyz/valinor": "<0.12", "czproject/git-php": "<4.0.3", "darylldoyle/safe-svg": "<1.9.10", "datadog/dd-trace": ">=0.30,<0.30.2", @@ -4456,12 +4408,13 @@ "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", "dolibarr/dolibarr": "<16|= 12.0.5|>= 3.3.beta1, < 13.0.2", - "dompdf/dompdf": "<1.2.1", + "dompdf/dompdf": "<2", "drupal/core": ">=7,<7.88|>=8,<9.2.13|>=9.3,<9.3.6", "drupal/drupal": ">=7,<7.80|>=8,<8.9.16|>=9,<9.1.12|>=9.2,<9.2.4", "dweeves/magmi": "<=0.7.24", "ecodev/newsletter": "<=4", "ectouch/ectouch": "<=2.7.2", + "elefant/cms": "<1.3.13", "elgg/elgg": "<3.3.24|>=4,<4.0.5", "endroid/qr-code-bundle": "<3.4.2", "enshrined/svg-sanitize": "<0.15", @@ -4508,7 +4461,7 @@ "fuel/core": "<1.8.1", "gaoming13/wechat-php-sdk": "<=1.10.2", "genix/cms": "<=1.1.11", - "getgrav/grav": "<1.7.33", + "getgrav/grav": "<1.7.34", "getkirby/cms": "<3.5.8", "getkirby/panel": "<2.5.14", "gilacms/gila": "<=1.11.4", @@ -4535,6 +4488,7 @@ "illuminate/view": "<6.20.42|>=7,<7.30.6|>=8,<8.75", "impresscms/impresscms": "<=1.4.3", "in2code/femanager": "<5.5.1|>=6,<6.3.1", + "in2code/lux": "<17.6.1|>=18,<24.0.2", "intelliants/subrion": "<=4.2.1", "ivankristianto/phpwhois": "<=4.3", "jackalope/jackalope-doctrine-dbal": "<1.7.4", @@ -4680,12 +4634,13 @@ "shopxo/shopxo": "<2.2.6", "showdoc/showdoc": "<2.10.4", "silverstripe/admin": ">=1,<1.8.1", - "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", + "silverstripe/assets": ">=1,<1.10.1", "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", - "silverstripe/framework": "<4.10.1", + "silverstripe/framework": "<4.10.9", "silverstripe/graphql": "<3.5.2|>=4-alpha.1,<4-alpha.2|= 4.0.0-alpha1", + "silverstripe/hybridsessions": ">=1,<2.4.1|>=2.5,<2.5.1", "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", "silverstripe/silverstripe-omnipay": "<2.5.2|>=3,<3.0.2|>=3.1,<3.1.4|>=3.2,<3.2.1", @@ -4758,9 +4713,10 @@ "thelia/backoffice-default-template": ">=2.1,<2.1.2", "thelia/thelia": ">=2.1-beta.1,<2.1.3", "theonedemon/phpwhois": "<=4.2.5", + "thinkcmf/thinkcmf": "<=5.1.7", "tinymce/tinymce": "<5.10", "titon/framework": ">=0,<9.9.99", - "topthink/framework": "<6.0.12", + "topthink/framework": "<=6.0.12", "topthink/think": "<=6.0.9", "topthink/thinkphp": "<=3.2.3", "tribalsystems/zenario": "<9.2.55826", @@ -4834,6 +4790,7 @@ "zfr/zfr-oauth2-server-module": "<0.1.2", "zoujingli/thinkadmin": "<6.0.22" }, + "default-branch": true, "type": "metapackage", "notification-url": "https://packagist.org/downloads/", "license": [ @@ -4866,7 +4823,7 @@ "type": "tidelift" } ], - "time": "2022-06-25T08:04:47+00:00" + "time": "2022-07-12T23:04:17+00:00" }, { "name": "sebastian/diff", @@ -4992,16 +4949,16 @@ }, { "name": "vimeo/psalm", - "version": "4.23.0", + "version": "4.24.0", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "f1fe6ff483bf325c803df9f510d09a03fd796f88" + "reference": "06dd975cb55d36af80f242561738f16c5f58264f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/f1fe6ff483bf325c803df9f510d09a03fd796f88", - "reference": "f1fe6ff483bf325c803df9f510d09a03fd796f88", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/06dd975cb55d36af80f242561738f16c5f58264f", + "reference": "06dd975cb55d36af80f242561738f16c5f58264f", "shasum": "" }, "require": { @@ -5093,9 +5050,9 @@ ], "support": { "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/4.23.0" + "source": "https://github.com/vimeo/psalm/tree/4.24.0" }, - "time": "2022-04-28T17:35:49+00:00" + "time": "2022-06-26T11:47:54+00:00" }, { "name": "webmozart/assert", diff --git a/src/Api/Tmdb/Api.php b/src/Api/Tmdb/Api.php index 6f72f2a7..e2a1af6d 100644 --- a/src/Api/Tmdb/Api.php +++ b/src/Api/Tmdb/Api.php @@ -7,6 +7,8 @@ class Api { + private array $languages = []; + public function __construct(private readonly Client $client) { } @@ -25,6 +27,21 @@ public function fetchMovieDetails(int $movieId) : Movie return Movie::createFromArray($data); } + public function getLanguageByCode(string $languageCode) : string + { + if ($this->languages === []) { + $this->languages = $this->client->get('/configuration/languages'); + } + + foreach ($this->languages as $language) { + if ($language['iso_639_1'] === $languageCode) { + return $language['english_name']; + } + } + + throw new \RuntimeException('Language code not handled: ' . $languageCode); + } + public function searchMovie(string $searchTerm) : array { $data = $this->client->get('/search/movie', ['query' => $searchTerm]); diff --git a/src/Application/Movie/Api.php b/src/Application/Movie/Api.php index 9a08afd0..db8828cd 100644 --- a/src/Application/Movie/Api.php +++ b/src/Application/Movie/Api.php @@ -2,7 +2,7 @@ namespace Movary\Application\Movie; -use Matriphe\ISO639\ISO639; +use Movary\Api\Tmdb; use Movary\Api\Tmdb\Dto\Cast; use Movary\Api\Tmdb\Dto\Crew; use Movary\Api\Trakt\ValueObject\Movie\TraktId; @@ -25,7 +25,7 @@ public function __construct( private readonly Movie\Genre\Service\Select $genreSelectService, private readonly Movie\Cast\Service\Select $castSelectService, private readonly Movie\Crew\Service\Select $crewSelectService, - private readonly ISO639 $ISO639, + private readonly Tmdb\Api $tmdbApi, private readonly Repository $movieRepository ) { } @@ -156,6 +156,8 @@ public function findById(int $movieId) : ?array $renderedRuntime .= ' ' . $minutes . 'm'; } + $originalLanguageCode = $entity->getOriginalLanguage(); + return [ 'id' => $entity->getId(), 'title' => $entity->getTitle(), @@ -164,7 +166,7 @@ public function findById(int $movieId) : ?array 'tagline' => $entity->getTagline(), 'overview' => $entity->getOverview(), 'runtime' => $renderedRuntime, - 'originalLanguage' => $this->ISO639->languageByCode1($entity->getOriginalLanguage()), + 'originalLanguage' => $originalLanguageCode === null ? null : $this->tmdbApi->getLanguageByCode($originalLanguageCode), ]; } diff --git a/src/Application/Movie/History/Service/Select.php b/src/Application/Movie/History/Service/Select.php index c0577317..995a125b 100644 --- a/src/Application/Movie/History/Service/Select.php +++ b/src/Application/Movie/History/Service/Select.php @@ -2,7 +2,7 @@ namespace Movary\Application\Movie\History\Service; -use Matriphe\ISO639\ISO639; +use Movary\Api\Tmdb; use Movary\Api\Trakt\ValueObject\Movie\TraktId; use Movary\Application\Movie; use Movary\Application\Movie\Entity; @@ -13,7 +13,7 @@ class Select { public function __construct( private readonly Movie\Repository $movieRepository, - private readonly ISO639 $ISO639 + private readonly Tmdb\Api $tmdbApi ) { } @@ -117,7 +117,7 @@ public function fetchMostWatchedLanguages(int $userId) : array $mostWatchedLanguages = $this->movieRepository->fetchMostWatchedLanguages($userId); foreach ($mostWatchedLanguages as $index => $mostWatchedLanguage) { - $mostWatchedLanguages[$index]['name'] = $this->ISO639->languageByCode1($mostWatchedLanguage['language']); + $mostWatchedLanguages[$index]['name'] = $this->tmdbApi->getLanguageByCode($mostWatchedLanguage['language']); } return $mostWatchedLanguages; diff --git a/src/Application/Movie/Repository.php b/src/Application/Movie/Repository.php index 30a7c750..c3b871dd 100644 --- a/src/Application/Movie/Repository.php +++ b/src/Application/Movie/Repository.php @@ -318,7 +318,7 @@ public function fetchMostWatchedLanguages(int $userId) : array return $this->dbConnection->fetchAllAssociative( 'SELECT DISTINCT original_language AS language, COUNT(*) AS count FROM movie m - WHERE m.id IN (SELECT DISTINCT movie_id FROM movie_user_watch_dates mh WHERE user_id = ?) + WHERE m.id IN (SELECT DISTINCT movie_id FROM movie_user_watch_dates mh WHERE user_id = ?) AND m.original_language IS NOT NULL GROUP BY original_language ORDER BY COUNT(*) DESC, original_language', [$userId]