Compare commits
2 Commits
857cd10580
...
edd4a185da
| Author | SHA1 | Date |
|---|---|---|
|
|
edd4a185da | |
|
|
59991f006c |
|
|
@ -10,6 +10,7 @@
|
||||||
"doctrine/doctrine-bundle": "^3.1",
|
"doctrine/doctrine-bundle": "^3.1",
|
||||||
"doctrine/doctrine-migrations-bundle": "^4.0",
|
"doctrine/doctrine-migrations-bundle": "^4.0",
|
||||||
"doctrine/orm": "^3.6",
|
"doctrine/orm": "^3.6",
|
||||||
|
"ramsey/uuid-doctrine": "^2.1",
|
||||||
"symfony/console": "8.0.*",
|
"symfony/console": "8.0.*",
|
||||||
"symfony/dotenv": "8.0.*",
|
"symfony/dotenv": "8.0.*",
|
||||||
"symfony/flex": "^2",
|
"symfony/flex": "^2",
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,68 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "afb560e3a07ed0676f1efc6f4118735d",
|
"content-hash": "02657b010196b6bde0f0c61b3c41708c",
|
||||||
"packages": [
|
"packages": [
|
||||||
|
{
|
||||||
|
"name": "brick/math",
|
||||||
|
"version": "0.14.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/brick/math.git",
|
||||||
|
"reference": "f05858549e5f9d7bb45875a75583240a38a281d0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/brick/math/zipball/f05858549e5f9d7bb45875a75583240a38a281d0",
|
||||||
|
"reference": "f05858549e5f9d7bb45875a75583240a38a281d0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^8.2"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"php-coveralls/php-coveralls": "^2.2",
|
||||||
|
"phpstan/phpstan": "2.1.22",
|
||||||
|
"phpunit/phpunit": "^11.5"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Brick\\Math\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "Arbitrary-precision arithmetic library",
|
||||||
|
"keywords": [
|
||||||
|
"Arbitrary-precision",
|
||||||
|
"BigInteger",
|
||||||
|
"BigRational",
|
||||||
|
"arithmetic",
|
||||||
|
"bigdecimal",
|
||||||
|
"bignum",
|
||||||
|
"bignumber",
|
||||||
|
"brick",
|
||||||
|
"decimal",
|
||||||
|
"integer",
|
||||||
|
"math",
|
||||||
|
"mathematics",
|
||||||
|
"rational"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/brick/math/issues",
|
||||||
|
"source": "https://github.com/brick/math/tree/0.14.1"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/BenMorel",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2025-11-24T14:40:29+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/collections",
|
"name": "doctrine/collections",
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
|
|
@ -1426,6 +1486,244 @@
|
||||||
},
|
},
|
||||||
"time": "2024-09-11T13:17:53+00:00"
|
"time": "2024-09-11T13:17:53+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "ramsey/collection",
|
||||||
|
"version": "2.1.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ramsey/collection.git",
|
||||||
|
"reference": "344572933ad0181accbf4ba763e85a0306a8c5e2"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2",
|
||||||
|
"reference": "344572933ad0181accbf4ba763e85a0306a8c5e2",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": "^8.1"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"captainhook/plugin-composer": "^5.3",
|
||||||
|
"ergebnis/composer-normalize": "^2.45",
|
||||||
|
"fakerphp/faker": "^1.24",
|
||||||
|
"hamcrest/hamcrest-php": "^2.0",
|
||||||
|
"jangregor/phpstan-prophecy": "^2.1",
|
||||||
|
"mockery/mockery": "^1.6",
|
||||||
|
"php-parallel-lint/php-console-highlighter": "^1.0",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.4",
|
||||||
|
"phpspec/prophecy-phpunit": "^2.3",
|
||||||
|
"phpstan/extension-installer": "^1.4",
|
||||||
|
"phpstan/phpstan": "^2.1",
|
||||||
|
"phpstan/phpstan-mockery": "^2.0",
|
||||||
|
"phpstan/phpstan-phpunit": "^2.0",
|
||||||
|
"phpunit/phpunit": "^10.5",
|
||||||
|
"ramsey/coding-standard": "^2.3",
|
||||||
|
"ramsey/conventional-commits": "^1.6",
|
||||||
|
"roave/security-advisories": "dev-latest"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"captainhook": {
|
||||||
|
"force-install": true
|
||||||
|
},
|
||||||
|
"ramsey/conventional-commits": {
|
||||||
|
"configFile": "conventional-commits.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Ramsey\\Collection\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Ben Ramsey",
|
||||||
|
"email": "ben@benramsey.com",
|
||||||
|
"homepage": "https://benramsey.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A PHP library for representing and manipulating collections.",
|
||||||
|
"keywords": [
|
||||||
|
"array",
|
||||||
|
"collection",
|
||||||
|
"hash",
|
||||||
|
"map",
|
||||||
|
"queue",
|
||||||
|
"set"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/ramsey/collection/issues",
|
||||||
|
"source": "https://github.com/ramsey/collection/tree/2.1.1"
|
||||||
|
},
|
||||||
|
"time": "2025-03-22T05:38:12+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ramsey/uuid",
|
||||||
|
"version": "4.9.2",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ramsey/uuid.git",
|
||||||
|
"reference": "8429c78ca35a09f27565311b98101e2826affde0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0",
|
||||||
|
"reference": "8429c78ca35a09f27565311b98101e2826affde0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14",
|
||||||
|
"php": "^8.0",
|
||||||
|
"ramsey/collection": "^1.2 || ^2.0"
|
||||||
|
},
|
||||||
|
"replace": {
|
||||||
|
"rhumsaa/uuid": "self.version"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"captainhook/captainhook": "^5.25",
|
||||||
|
"captainhook/plugin-composer": "^5.3",
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "^1.0",
|
||||||
|
"ergebnis/composer-normalize": "^2.47",
|
||||||
|
"mockery/mockery": "^1.6",
|
||||||
|
"paragonie/random-lib": "^2",
|
||||||
|
"php-mock/php-mock": "^2.6",
|
||||||
|
"php-mock/php-mock-mockery": "^1.5",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.4.0",
|
||||||
|
"phpbench/phpbench": "^1.2.14",
|
||||||
|
"phpstan/extension-installer": "^1.4",
|
||||||
|
"phpstan/phpstan": "^2.1",
|
||||||
|
"phpstan/phpstan-mockery": "^2.0",
|
||||||
|
"phpstan/phpstan-phpunit": "^2.0",
|
||||||
|
"phpunit/phpunit": "^9.6",
|
||||||
|
"slevomat/coding-standard": "^8.18",
|
||||||
|
"squizlabs/php_codesniffer": "^3.13"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.",
|
||||||
|
"ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.",
|
||||||
|
"ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.",
|
||||||
|
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
|
||||||
|
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"captainhook": {
|
||||||
|
"force-install": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"src/functions.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"Ramsey\\Uuid\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"description": "A PHP library for generating and working with universally unique identifiers (UUIDs).",
|
||||||
|
"keywords": [
|
||||||
|
"guid",
|
||||||
|
"identifier",
|
||||||
|
"uuid"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/ramsey/uuid/issues",
|
||||||
|
"source": "https://github.com/ramsey/uuid/tree/4.9.2"
|
||||||
|
},
|
||||||
|
"time": "2025-12-14T04:43:48+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ramsey/uuid-doctrine",
|
||||||
|
"version": "2.1.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ramsey/uuid-doctrine.git",
|
||||||
|
"reference": "491e1bfa4d9d81e52a60470fa92c871f7eef919e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/ramsey/uuid-doctrine/zipball/491e1bfa4d9d81e52a60470fa92c871f7eef919e",
|
||||||
|
"reference": "491e1bfa4d9d81e52a60470fa92c871f7eef919e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"doctrine/dbal": "^2.8 || ^3.0 || ^4.0",
|
||||||
|
"php": "^8.1",
|
||||||
|
"ramsey/uuid": "^3.9.7 || ^4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"captainhook/plugin-composer": "^5.3",
|
||||||
|
"doctrine/orm": "^2.5 || ^3.0",
|
||||||
|
"ergebnis/composer-normalize": "^2.28.3",
|
||||||
|
"mockery/mockery": "^1.5",
|
||||||
|
"php-parallel-lint/php-console-highlighter": "^1.0",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.3",
|
||||||
|
"phpcsstandards/phpcsutils": "^1.0.0-alpha4",
|
||||||
|
"phpstan/extension-installer": "^1.2",
|
||||||
|
"phpstan/phpstan": "^1.9",
|
||||||
|
"phpstan/phpstan-mockery": "^1.1",
|
||||||
|
"phpstan/phpstan-phpunit": "^1.3",
|
||||||
|
"phpunit/phpunit": "^10.5",
|
||||||
|
"ramsey/coding-standard": "^2.0.3",
|
||||||
|
"ramsey/conventional-commits": "^1.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"captainhook": {
|
||||||
|
"force-install": true
|
||||||
|
},
|
||||||
|
"ramsey/conventional-commits": {
|
||||||
|
"configFile": "conventional-commits.json"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Ramsey\\Uuid\\Doctrine\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Ben Ramsey",
|
||||||
|
"email": "ben@benramsey.com",
|
||||||
|
"homepage": "https://benramsey.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Use ramsey/uuid as a Doctrine field type.",
|
||||||
|
"keywords": [
|
||||||
|
"database",
|
||||||
|
"doctrine",
|
||||||
|
"guid",
|
||||||
|
"identifier",
|
||||||
|
"uuid"
|
||||||
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/ramsey/uuid-doctrine/issues",
|
||||||
|
"source": "https://github.com/ramsey/uuid-doctrine/tree/2.1.0"
|
||||||
|
},
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"url": "https://github.com/ramsey",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"url": "https://tidelift.com/funding/github/packagist/ramsey/uuid-doctrine",
|
||||||
|
"type": "tidelift"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"time": "2024-05-27T00:00:21+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/cache",
|
"name": "symfony/cache",
|
||||||
"version": "v8.0.1",
|
"version": "v8.0.1",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ doctrine:
|
||||||
server_version: '18'
|
server_version: '18'
|
||||||
|
|
||||||
profiling_collect_backtrace: '%kernel.debug%'
|
profiling_collect_backtrace: '%kernel.debug%'
|
||||||
|
|
||||||
|
types:
|
||||||
|
uuid: 'Ramsey\Uuid\Doctrine\UuidType'
|
||||||
orm:
|
orm:
|
||||||
validate_xml_mapping: true
|
validate_xml_mapping: true
|
||||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||||
|
|
@ -23,6 +26,12 @@ doctrine:
|
||||||
is_bundle: false
|
is_bundle: false
|
||||||
prefix: App\Domain\Entity
|
prefix: App\Domain\Entity
|
||||||
alias: App
|
alias: App
|
||||||
|
App\Application\ReadModel:
|
||||||
|
type: php
|
||||||
|
dir: '%kernel.project_dir%/src/Infrastructure/Persistence/Mapping'
|
||||||
|
is_bundle: false
|
||||||
|
prefix: App\Application\ReadModel
|
||||||
|
alias: App
|
||||||
controller_resolver:
|
controller_resolver:
|
||||||
auto_mapping: false
|
auto_mapping: false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
imports:
|
||||||
|
- { resource: services.yaml }
|
||||||
|
|
||||||
|
services:
|
||||||
|
App\Application\SportRadar\SportRadarEngine: '@App\Infrastructure\SportRadar\FakeSportRadarEngine'
|
||||||
|
|
@ -7,3 +7,6 @@ parameters:
|
||||||
message: "#^Property .+::.+ is never read, only written\\.$#"
|
message: "#^Property .+::.+ is never read, only written\\.$#"
|
||||||
paths:
|
paths:
|
||||||
- src/Domain/Entity/*.php
|
- src/Domain/Entity/*.php
|
||||||
|
-
|
||||||
|
message: "#^Variable \\$metadata might not be defined\\.$#"
|
||||||
|
path: src/Infrastructure/Persistence/Mapping/*.php
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Application\ReadModel;
|
||||||
|
|
||||||
|
class Provider
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
public readonly string $id,
|
||||||
|
public readonly string $name,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Application\UseCase;
|
||||||
|
|
||||||
|
use App\Application\SportRadar\SportRadarEngine;
|
||||||
|
use App\Domain\Entity\Game;
|
||||||
|
use App\Domain\Entity\Provider;
|
||||||
|
use App\Domain\Entity\Season;
|
||||||
|
use App\Domain\Entity\Team;
|
||||||
|
use App\Domain\Enum\ENHLSeasonType;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
||||||
|
class FetchNHLMatch
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
private readonly SportRadarEngine $sportRadarEngine,
|
||||||
|
private readonly EntityManagerInterface $entityManager,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __invoke(FetchNHLMatchRequest $request): void
|
||||||
|
{
|
||||||
|
$provider = $this->entityManager->getRepository(Provider::class)->findOneBy(['id' => '885fe581-c4c3-45e7-a06c-29ece7d47fad']); // id should not be here
|
||||||
|
$matchs = $this->sportRadarEngine->getNHLSchedule($request->year, ENHLSeasonType::from($request->type));
|
||||||
|
|
||||||
|
$season = $this->entityManager->getRepository(Season::class)->findOneBy(['providerSeasonId' => $matchs['season']['providerId']]);
|
||||||
|
/** @var array<string, Team> $teams */
|
||||||
|
$teams = [];
|
||||||
|
|
||||||
|
foreach ($matchs['games'] as $match) {
|
||||||
|
$game = new Game();
|
||||||
|
$game->create(
|
||||||
|
$provider,
|
||||||
|
$match['providerId'],
|
||||||
|
$season,
|
||||||
|
$match['scheduled'],
|
||||||
|
null,
|
||||||
|
$teams[$match['homeTeamProviderId']] ?? $teams[$match['homeTeamProviderId']] = $this->findTeamOrThrow($provider, $match['homeTeamProviderId']),
|
||||||
|
$teams[$match['awayTeamProviderId']] ?? $teams[$match['awayTeamProviderId']] = $this->findTeamOrThrow($provider, $match['awayTeamProviderId']),
|
||||||
|
$match['venueArena'],
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->entityManager->persist($game);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->entityManager->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function findTeamOrThrow(Provider $provider, string $teamId): Team // should be in a trait?
|
||||||
|
{
|
||||||
|
return $this->entityManager->getRepository(Team::class)->findOneBy(['provider' => $provider, 'providerTeamId' => $teamId]) ?? throw new \Exception("Team $teamId not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Application\UseCase;
|
namespace App\Application\UseCase;
|
||||||
|
|
||||||
class GetNHLMatchRequest
|
class FetchNHLMatchRequest
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public readonly int $year,
|
public readonly int $year,
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Application\UseCase;
|
|
||||||
|
|
||||||
use App\Application\SportRadar\SportRadarEngine;
|
|
||||||
use App\Domain\Enum\ENHLSeasonType;
|
|
||||||
|
|
||||||
class GetNHLMatch
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private readonly SportRadarEngine $sportRadarEngine,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __invoke(GetNHLMatchRequest $request): void
|
|
||||||
{
|
|
||||||
dd($this->sportRadarEngine->getNHLSchedule($request->year, ENHLSeasonType::from($request->type))['games'][0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,26 +6,32 @@ namespace App\Domain\Entity;
|
||||||
|
|
||||||
class Game extends AEntity
|
class Game extends AEntity
|
||||||
{
|
{
|
||||||
private string $srId;
|
private Provider $provider;
|
||||||
|
private string $providerGameId;
|
||||||
private Season $season;
|
private Season $season;
|
||||||
private \DateTimeImmutable $scheduled;
|
private \DateTimeImmutable $startTimeScheduled;
|
||||||
|
private ?\DateTimeImmutable $endTimeScheduled;
|
||||||
private Team $home;
|
private Team $home;
|
||||||
private Team $away;
|
private Team $away;
|
||||||
private string $venue_arena;
|
private string $venue;
|
||||||
|
|
||||||
public function create(
|
public function create(
|
||||||
string $srId,
|
Provider $provider,
|
||||||
|
string $providerGameId,
|
||||||
Season $season,
|
Season $season,
|
||||||
\DateTimeImmutable $scheduled,
|
\DateTimeImmutable $startTimeScheduled,
|
||||||
|
?\DateTimeImmutable $endTimeScheduled,
|
||||||
Team $home,
|
Team $home,
|
||||||
Team $away,
|
Team $away,
|
||||||
string $venue_arena,
|
string $venue,
|
||||||
): void {
|
): void {
|
||||||
$this->srId = $srId;
|
$this->provider = $provider;
|
||||||
|
$this->providerGameId = $providerGameId;
|
||||||
$this->season = $season;
|
$this->season = $season;
|
||||||
$this->scheduled = $scheduled;
|
$this->startTimeScheduled = $startTimeScheduled;
|
||||||
|
$this->endTimeScheduled = $endTimeScheduled;
|
||||||
$this->home = $home;
|
$this->home = $home;
|
||||||
$this->away = $away;
|
$this->away = $away;
|
||||||
$this->venue_arena = $venue_arena;
|
$this->venue = $venue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,17 @@ namespace App\Domain\Entity;
|
||||||
|
|
||||||
class League extends AEntity
|
class League extends AEntity
|
||||||
{
|
{
|
||||||
|
private Provider $provider;
|
||||||
|
private string $providerLeagueId;
|
||||||
private string $name;
|
private string $name;
|
||||||
|
|
||||||
public function create(
|
public function create(
|
||||||
|
Provider $provider,
|
||||||
|
string $providerLeagueId,
|
||||||
string $name,
|
string $name,
|
||||||
): void {
|
): void {
|
||||||
|
$this->provider = $provider;
|
||||||
|
$this->providerLeagueId = $providerLeagueId;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Domain\Entity;
|
||||||
|
|
||||||
|
class Provider extends AEntity
|
||||||
|
{
|
||||||
|
private string $name;
|
||||||
|
|
||||||
|
public function create(
|
||||||
|
string $name,
|
||||||
|
): void {
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,17 +6,23 @@ namespace App\Domain\Entity;
|
||||||
|
|
||||||
class Season extends AEntity
|
class Season extends AEntity
|
||||||
{
|
{
|
||||||
|
private Provider $provider;
|
||||||
|
private string $providerSeasonId;
|
||||||
private League $league;
|
private League $league;
|
||||||
private string $type; // should be an enum
|
|
||||||
private int $year;
|
private int $year;
|
||||||
|
private string $kind; // should be an enum
|
||||||
|
|
||||||
public function create(
|
public function create(
|
||||||
|
Provider $provider,
|
||||||
|
string $providerSeasonId,
|
||||||
League $league,
|
League $league,
|
||||||
string $type,
|
string $kind,
|
||||||
int $year,
|
int $year,
|
||||||
): void {
|
): void {
|
||||||
|
$this->provider = $provider;
|
||||||
|
$this->providerSeasonId = $providerSeasonId;
|
||||||
$this->league = $league;
|
$this->league = $league;
|
||||||
$this->type = $type;
|
$this->kind = $kind;
|
||||||
$this->year = $year;
|
$this->year = $year;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,17 +6,23 @@ namespace App\Domain\Entity;
|
||||||
|
|
||||||
class Team extends AEntity
|
class Team extends AEntity
|
||||||
{
|
{
|
||||||
|
private Provider $provider;
|
||||||
|
private string $providerTeamId;
|
||||||
private string $name;
|
private string $name;
|
||||||
private string $alias;
|
private string $alias;
|
||||||
private string $sr_id;
|
private bool $active;
|
||||||
|
|
||||||
public function create(
|
public function create(
|
||||||
|
Provider $provider,
|
||||||
|
string $providerTeamId,
|
||||||
string $name,
|
string $name,
|
||||||
string $alias,
|
string $alias,
|
||||||
string $sr_id,
|
bool $active,
|
||||||
): void {
|
): void {
|
||||||
|
$this->provider = $provider;
|
||||||
|
$this->providerTeamId = $providerTeamId;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->alias = $alias;
|
$this->alias = $alias;
|
||||||
$this->sr_id = $sr_id;
|
$this->active = $active;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace App\Infrastructure\Console;
|
namespace App\Infrastructure\Console;
|
||||||
|
|
||||||
use App\Application\CommandBus\UseCaseCommandBus;
|
use App\Application\CommandBus\UseCaseCommandBus;
|
||||||
use App\Application\UseCase\GetNHLMatchRequest;
|
use App\Application\UseCase\FetchNHLMatchRequest;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ class GetNHLScheduleCommand
|
||||||
|
|
||||||
public function __invoke(): int
|
public function __invoke(): int
|
||||||
{
|
{
|
||||||
$this->commandBus->ask(new GetNHLMatchRequest(2025, 'REG'));
|
$this->commandBus->ask(new FetchNHLMatchRequest(2025, 'REG'));
|
||||||
|
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$builder = new Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->setReadOnly()
|
||||||
|
->setTable('provider')
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('id', 'uuid')
|
||||||
|
->nullable(false)
|
||||||
|
->makePrimaryKey()
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('name', 'string')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$builder = new Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->setReadOnly()
|
||||||
|
->setTable('game')
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('id', 'uuid')
|
||||||
|
->nullable(false)
|
||||||
|
->makePrimaryKey()
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('providerGameId', 'uuid')
|
||||||
|
->columnName('provider_game_id')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('startTimeScheduled', 'datetimetz_immutable')
|
||||||
|
->columnName('start_time_scheduled')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('endTimeScheduled', 'datetimetz_immutable')
|
||||||
|
->columnName('end_time_scheduled')
|
||||||
|
->nullable(true)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('venue', 'string')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('provider', App\Domain\Entity\Provider::class)
|
||||||
|
->addJoinColumn('provider_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('season', App\Domain\Entity\Season::class)
|
||||||
|
->addJoinColumn('season_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('home', App\Domain\Entity\Team::class)
|
||||||
|
->addJoinColumn('home_team_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('away', App\Domain\Entity\Team::class)
|
||||||
|
->addJoinColumn('away_team_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$builder = new Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->setReadOnly()
|
||||||
|
->setTable('league')
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('id', 'uuid')
|
||||||
|
->nullable(false)
|
||||||
|
->makePrimaryKey()
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('providerLeagueId', 'uuid')
|
||||||
|
->columnName('provider_league_id')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('provider', 'App\\Domain\\Entity\\Provider')
|
||||||
|
->addJoinColumn('provider_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$builder = new Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->setReadOnly()
|
||||||
|
->setTable('provider')
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('id', 'uuid')
|
||||||
|
->nullable(false)
|
||||||
|
->makePrimaryKey()
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('name', 'string')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$builder = new Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->setReadOnly()
|
||||||
|
->setTable('season')
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('id', 'uuid')
|
||||||
|
->nullable(false)
|
||||||
|
->makePrimaryKey()
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('providerSeasonId', 'uuid')
|
||||||
|
->columnName('provider_season_id')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('year', 'integer')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('kind', 'string') // should be enum
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('provider', App\Domain\Entity\Provider::class)
|
||||||
|
->addJoinColumn('provider_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('league', App\Domain\Entity\League::class)
|
||||||
|
->addJoinColumn('league_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$builder = new Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder($metadata);
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->setReadOnly()
|
||||||
|
->setTable('team')
|
||||||
|
;
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('id', 'uuid')
|
||||||
|
->nullable(false)
|
||||||
|
->makePrimaryKey()
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('providerTeamId', 'uuid')
|
||||||
|
->columnName('provider_team_id')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('name', 'string')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('alias', 'string')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createField('active', 'boolean')
|
||||||
|
->nullable(false)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
$builder
|
||||||
|
->createManyToOne('provider', App\Domain\Entity\Provider::class)
|
||||||
|
->addJoinColumn('provider_id', 'id', false, false, 'CASCADE')
|
||||||
|
->build();
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Infrastructure\SportRadar;
|
||||||
|
|
||||||
|
use App\Application\SportRadar\SportRadarEngine;
|
||||||
|
use App\Domain\Enum\ENHLSeasonType;
|
||||||
|
|
||||||
|
class FakeSportRadarEngine implements SportRadarEngine
|
||||||
|
{
|
||||||
|
public function getNHLSchedule(int $year, ENHLSeasonType $seasonType): array
|
||||||
|
{
|
||||||
|
if (2025 !== $year || ENHLSeasonType::REGULAR_SEASON !== $seasonType) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$fake_sport_radar_nhl_schedule = json_decode(file_get_contents(__DIR__ . '/Fixtures/sport_radar_nhl_schedule_2025_REG_19_12_2025.json'), true);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'league' => [
|
||||||
|
'providerId' => $fake_sport_radar_nhl_schedule['league']['id'],
|
||||||
|
'name' => $fake_sport_radar_nhl_schedule['league']['name'],
|
||||||
|
'alias' => $fake_sport_radar_nhl_schedule['league']['alias'],
|
||||||
|
],
|
||||||
|
'season' => [
|
||||||
|
'providerId' => $fake_sport_radar_nhl_schedule['season']['id'],
|
||||||
|
'year' => $fake_sport_radar_nhl_schedule['season']['year'],
|
||||||
|
'type' => ENHLSeasonType::from($fake_sport_radar_nhl_schedule['season']['type']),
|
||||||
|
],
|
||||||
|
'games' => array_map(fn ($game) => [
|
||||||
|
'providerId' => $game['id'],
|
||||||
|
'scheduled' => new \DateTimeImmutable($game['scheduled']),
|
||||||
|
'homeTeamProviderId' => $game['home']['id'],
|
||||||
|
'awayTeamProviderId' => $game['away']['id'],
|
||||||
|
'venueArena' => $game['venue']['name'],
|
||||||
|
], $fake_sport_radar_nhl_schedule['games']),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
12
symfony.lock
12
symfony.lock
|
|
@ -59,6 +59,18 @@
|
||||||
"phpstan.dist.neon"
|
"phpstan.dist.neon"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"ramsey/uuid-doctrine": {
|
||||||
|
"version": "2.1",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes-contrib",
|
||||||
|
"branch": "main",
|
||||||
|
"version": "1.3",
|
||||||
|
"ref": "471aed0fbf5620b8d7f92b7a5ebbbf6c0945c27a"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"config/packages/ramsey_uuid_doctrine.yaml"
|
||||||
|
]
|
||||||
|
},
|
||||||
"symfony/console": {
|
"symfony/console": {
|
||||||
"version": "8.0",
|
"version": "8.0",
|
||||||
"recipe": {
|
"recipe": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue