Skip to content

Commit f9137a9

Browse files
authored
Merge pull request #805 from patchlevel/remove-deprecated-subscriper-util-and-helper
remove deprecated subscriber util and helper
2 parents 72e8d5d + 23b46ac commit f9137a9

8 files changed

Lines changed: 15 additions & 112 deletions

File tree

src/Subscription/Subscriber/SubscriberHelper.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/Subscription/Subscriber/SubscriberUtil.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/Benchmark/BasicImplementation/Projection/BatchProfileProjector.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
use Patchlevel\EventSourcing\Attribute\Subscribe;
1111
use Patchlevel\EventSourcing\Attribute\Teardown;
1212
use Patchlevel\EventSourcing\Subscription\Subscriber\BatchableSubscriber;
13-
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberUtil;
1413
use Patchlevel\EventSourcing\Tests\Benchmark\BasicImplementation\Events\NameChanged;
1514
use Patchlevel\EventSourcing\Tests\Benchmark\BasicImplementation\Events\ProfileCreated;
1615

17-
#[Projector('profile')]
16+
#[Projector(self::SUBSCRIBER_ID)]
1817
final class BatchProfileProjector implements BatchableSubscriber
1918
{
20-
use SubscriberUtil;
19+
private const SUBSCRIBER_ID = 'profile';
2120

2221
/** @var array<string, string> */
2322
private array $nameChanged = [];
@@ -59,7 +58,7 @@ public function onNameChanged(NameChanged $nameChanged): void
5958

6059
public function table(): string
6160
{
62-
return 'projection_' . $this->subscriberId();
61+
return 'projection_' . self::SUBSCRIBER_ID;
6362
}
6463

6564
public function beginBatch(): void

tests/Benchmark/BasicImplementation/Projection/ProfileProjector.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010
use Patchlevel\EventSourcing\Attribute\Setup;
1111
use Patchlevel\EventSourcing\Attribute\Subscribe;
1212
use Patchlevel\EventSourcing\Attribute\Teardown;
13-
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberUtil;
1413
use Patchlevel\EventSourcing\Tests\Benchmark\BasicImplementation\Events\NameChanged;
1514
use Patchlevel\EventSourcing\Tests\Benchmark\BasicImplementation\Events\ProfileCreated;
1615
use Patchlevel\EventSourcing\Tests\Benchmark\BasicImplementation\Query\QueryProfileName;
1716

18-
#[Projector('profile')]
17+
#[Projector(self::SUBSCRIBER_ID)]
1918
final class ProfileProjector
2019
{
21-
use SubscriberUtil;
20+
private const SUBSCRIBER_ID = 'profile';
2221

2322
public function __construct(
2423
private Connection $connection,
@@ -70,6 +69,6 @@ public function getProfileName(QueryProfileName $queryProfileName): string
7069

7170
public function table(): string
7271
{
73-
return 'projection_' . $this->subscriberId();
72+
return 'projection_' . self::SUBSCRIBER_ID;
7473
}
7574
}

tests/Integration/Subscription/Subscriber/LookupSubscriber.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414
use Patchlevel\EventSourcing\Message\Reducer;
1515
use Patchlevel\EventSourcing\Subscription\Lookup\Lookup;
1616
use Patchlevel\EventSourcing\Subscription\RunMode;
17-
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberUtil;
1817
use Patchlevel\EventSourcing\Tests\Integration\Subscription\Events\AdminPromoted;
1918
use Patchlevel\EventSourcing\Tests\Integration\Subscription\Events\NameChanged;
2019
use Patchlevel\EventSourcing\Tests\Integration\Subscription\Events\ProfileCreated;
2120

22-
#[Subscriber('lookup', RunMode::FromBeginning)]
21+
#[Subscriber(self::SUBSCRIBER_ID, RunMode::FromBeginning)]
2322
final class LookupSubscriber
2423
{
25-
use SubscriberUtil;
24+
private const SUBSCRIBER_ID = 'lookup';
2625

2726
public function __construct(
2827
private Connection $connection,
@@ -78,6 +77,6 @@ public function drop(): void
7877

7978
private function tableName(): string
8079
{
81-
return 'projection_' . $this->subscriberId();
80+
return 'projection_' . self::SUBSCRIBER_ID;
8281
}
8382
}

tests/Integration/Subscription/Subscriber/ProfileNewProjection.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
use Patchlevel\EventSourcing\Attribute\Setup;
1111
use Patchlevel\EventSourcing\Attribute\Subscribe;
1212
use Patchlevel\EventSourcing\Attribute\Teardown;
13-
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberUtil;
1413
use Patchlevel\EventSourcing\Tests\Integration\Subscription\Events\ProfileCreated;
1514

16-
#[Projector('profile_2')]
15+
#[Projector(self::SUBSCRIBER_ID)]
1716
final class ProfileNewProjection
1817
{
19-
use SubscriberUtil;
18+
private const SUBSCRIBER_ID = 'profile_2';
2019

2120
public function __construct(
2221
private Connection $connection,
@@ -54,6 +53,6 @@ public function handleProfileCreated(ProfileCreated $profileCreated): void
5453

5554
private function tableName(): string
5655
{
57-
return 'projection_' . $this->subscriberId();
56+
return 'projection_' . self::SUBSCRIBER_ID;
5857
}
5958
}

tests/Integration/Subscription/Subscriber/ProfileProjection.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
use Patchlevel\EventSourcing\Attribute\Subscribe;
1212
use Patchlevel\EventSourcing\Attribute\Teardown;
1313
use Patchlevel\EventSourcing\Subscription\Subscriber\BatchableSubscriber;
14-
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberUtil;
1514
use Patchlevel\EventSourcing\Tests\Integration\Subscription\Events\ProfileCreated;
1615

17-
#[Projector('profile_1')]
16+
#[Projector(self::SUBSCRIBER_ID)]
1817
final class ProfileProjection implements BatchableSubscriber
1918
{
20-
use SubscriberUtil;
19+
private const SUBSCRIBER_ID = 'profile_1';
2120

2221
public function __construct(
2322
private Connection $connection,
@@ -55,7 +54,7 @@ public function handleProfileCreated(ProfileCreated $profileCreated): void
5554

5655
private function tableName(): string
5756
{
58-
return 'projection_' . $this->subscriberId();
57+
return 'projection_' . self::SUBSCRIBER_ID;
5958
}
6059

6160
public function beginBatch(): void

tests/Unit/Subscription/Subscriber/SubscriberHelperTest.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)