Skip to content

Commit

Permalink
Merge pull request #68 from programmatordev/SPA-74-add-new-sortorder-…
Browse files Browse the repository at this point in the history
…property

Add sortOrder property to Event entities
  • Loading branch information
andrepimpao authored Sep 21, 2024
2 parents 19ef1fe + 70ddced commit 1e7e662
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions docs/05-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
- `getRelatedPlayerId()`: `?int`
- `getPeriodId()`: `int`
- `getParticipantId()`: `int`
- `getSortOrder()`: `?int`
- `getCoachId()`: `?int`
- `getSection()`: `?string`
- `getPlayerName()`: `?string`
Expand Down
8 changes: 8 additions & 0 deletions src/Entity/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class Event

private int $participantId;

private ?int $sortOrder;

private ?string $section;

private ?string $playerName;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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());
Expand Down

0 comments on commit 1e7e662

Please sign in to comment.