feat: create Provider entity + load stub data

This commit is contained in:
Aymeric GUERACAGUE 2025-12-20 21:38:03 +01:00
parent 857cd10580
commit 59991f006c
Signed by: Superkooka
GPG Key ID: F78F2B172E894865
9 changed files with 394 additions and 1 deletions

View File

@ -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",

300
composer.lock generated
View File

@ -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",

View File

@ -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

View File

@ -0,0 +1,12 @@
<?php
namespace App\Application\ReadModel;
class Provider
{
public function __construct(
public readonly string $id,
public readonly string $name,
) {
}
}

View File

@ -4,18 +4,22 @@ declare(strict_types=1);
namespace App\Application\UseCase; namespace App\Application\UseCase;
use App\Application\ReadModel\Provider;
use App\Application\SportRadar\SportRadarEngine; use App\Application\SportRadar\SportRadarEngine;
use App\Domain\Enum\ENHLSeasonType; use App\Domain\Enum\ENHLSeasonType;
use Doctrine\ORM\EntityManagerInterface;
class GetNHLMatch class GetNHLMatch
{ {
public function __construct( public function __construct(
private readonly SportRadarEngine $sportRadarEngine, private readonly SportRadarEngine $sportRadarEngine,
private readonly EntityManagerInterface $entityManager,
) { ) {
} }
public function __invoke(GetNHLMatchRequest $request): void public function __invoke(GetNHLMatchRequest $request): void
{ {
dd($this->entityManager->getRepository(Provider::class)->findAll());
dd($this->sportRadarEngine->getNHLSchedule($request->year, ENHLSeasonType::from($request->type))['games'][0]); dd($this->sportRadarEngine->getNHLSchedule($request->year, ENHLSeasonType::from($request->type))['games'][0]);
} }
} }

View File

@ -0,0 +1,15 @@
<?php
namespace App\Domain\Entity;
class Provider extends AEntity
{
private string $name;
public function create(
string $name,
): void {
$this->name = $name;
}
}

View File

@ -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();

View File

@ -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();

View File

@ -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": {