From 70ddcedb4e04b9ef8e789bb8ad1a1bbb9cb26af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Pimpa=CC=83o?= Date: Sat, 21 Sep 2024 17:07:08 +0100 Subject: [PATCH] feat: added sortOrder property to Event entities --- composer.json | 6 +++--- docs/05-entities.md | 1 + src/Entity/Event.php | 8 ++++++++ tests/Unit/EventTest.php | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index c348e69..7ff6f2f 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,12 @@ ], "require": { "php": ">=8.1", - "myclabs/deep-copy": "^1.11", + "myclabs/deep-copy": "^1.12", "programmatordev/php-api-sdk": "^1.0", - "programmatordev/yet-another-php-validator": "^1.1" + "programmatordev/yet-another-php-validator": "^1.3" }, "require-dev": { - "monolog/monolog": "^3.6", + "monolog/monolog": "^3.7", "nyholm/psr7": "^1.8", "php-http/mock-client": "^1.6", "phpunit/phpunit": "^10.5", diff --git a/docs/05-entities.md b/docs/05-entities.md index 9ce7111..c081978 100644 --- a/docs/05-entities.md +++ b/docs/05-entities.md @@ -202,6 +202,7 @@ - `getRelatedPlayerId()`: `?int` - `getPeriodId()`: `int` - `getParticipantId()`: `int` +- `getSortOrder()`: `?int` - `getCoachId()`: `?int` - `getSection()`: `?string` - `getPlayerName()`: `?string` diff --git a/src/Entity/Event.php b/src/Entity/Event.php index 12df808..4f34f46 100644 --- a/src/Entity/Event.php +++ b/src/Entity/Event.php @@ -18,6 +18,8 @@ class Event private int $participantId; + private ?int $sortOrder; + private ?string $section; private ?string $playerName; @@ -63,6 +65,7 @@ public function __construct(array $data, string $timezone) $this->relatedPlayerId = $data['related_player_id'] ?? null; $this->periodId = $data['period_id']; $this->participantId = $data['participant_id']; + $this->sortOrder = $data['sort_order'] ?? null; // select $this->section = $data['section'] ?? null; @@ -122,6 +125,11 @@ public function getParticipantId(): int return $this->participantId; } + public function getSortOrder(): ?int + { + return $this->sortOrder; + } + public function getSection(): ?string { return $this->section; diff --git a/tests/Unit/EventTest.php b/tests/Unit/EventTest.php index b0824e0..f2a2417 100644 --- a/tests/Unit/EventTest.php +++ b/tests/Unit/EventTest.php @@ -17,6 +17,7 @@ public function testMethods(): void 'related_player_id' => 1, 'period_id' => 1, 'participant_id' => 1, + 'sort_order' => 1, 'section' => 'section', 'player_name' => 'player name', 'related_player_name' => 'related player name', @@ -37,6 +38,7 @@ public function testMethods(): void $this->assertSame(1, $entity->getRelatedPlayerId()); $this->assertSame(1, $entity->getPeriodId()); $this->assertSame(1, $entity->getParticipantId()); + $this->assertSame(1, $entity->getSortOrder()); $this->assertSame('section', $entity->getSection()); $this->assertSame('player name', $entity->getPlayerName()); $this->assertSame('related player name', $entity->getRelatedPlayerName());