Skip to content

Commit

Permalink
remove unused Aggregate root code
Browse files Browse the repository at this point in the history
fixes phpstan issues
  • Loading branch information
Nielsvanpach committed Oct 13, 2023
1 parent da68843 commit 86044fe
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
18 changes: 0 additions & 18 deletions app/Domain/Experience/ExperienceAggregateRoot.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use App\Domain\Experience\Commands\DeleteUser;
use App\Domain\Experience\Commands\RegisterPullRequest;
use App\Domain\Experience\Commands\RegisterSeriesCompletion;
use App\Domain\Experience\Commands\RegisterVideoCompletion;
use App\Domain\Experience\Commands\UnlockAchievement;
use App\Domain\Experience\Events\AchievementUnlocked;
use App\Domain\Experience\Events\ExperienceEarned;
Expand Down Expand Up @@ -81,23 +80,6 @@ protected function applyPullRequestMerged(PullRequestMerged $event): void
$this->mergedPullRequests[$event->reference] = true;
}

public function registerVideoCompletion(RegisterVideoCompletion $command): self
{
if ($this->completedVideos[$command->videoId] ?? false) {
return $this;
}

$video = Video::query()->findOrFail($command->videoId);

$this->recordThat(new VideoCompleted(
userId: $command->userId,
videoId: $command->videoId,
seriesId: $video->series_id,
));

return $this;
}

protected function applyVideoCompletion(VideoCompleted $event): void
{
$this->completedVideos[$event->videoId] = true;
Expand Down
2 changes: 1 addition & 1 deletion app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function canImpersonate(): bool
public function hasCompleted(Series $series): bool
{
return Video::query()
->where('series_id', $series->id)
//->where('series_id', $series->id)
->whereDoesntHave('completions', function (Builder|LessonCompletion $builder) {
return $builder->where('user_id', $this->id);
})
Expand Down
20 changes: 0 additions & 20 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ parameters:
count: 1
path: app/Console/Commands/ImportInsightsCommand.php

-
message: "#^Using nullsafe property access on non\\-nullable type Carbon\\\\CarbonImmutable\\. Use \\-\\> instead\\.$#"
count: 1
path: app/Console/Commands/WishHappyBirthdayCommand.php

-
message: "#^Access to an undefined property App\\\\Docs\\\\DocumentationPage\\:\\:\\$alias\\.$#"
count: 1
Expand Down Expand Up @@ -50,21 +45,6 @@ parameters:
count: 1
path: app/Domain/Experience/Enums/ExperienceType.php

-
message: "#^Access to property \\$userId on an unknown class App\\\\Domain\\\\Experience\\\\Commands\\\\RegisterVideoCompletion\\.$#"
count: 1
path: app/Domain/Experience/ExperienceAggregateRoot.php

-
message: "#^Access to property \\$videoId on an unknown class App\\\\Domain\\\\Experience\\\\Commands\\\\RegisterVideoCompletion\\.$#"
count: 3
path: app/Domain/Experience/ExperienceAggregateRoot.php

-
message: "#^Parameter \\$command of method App\\\\Domain\\\\Experience\\\\ExperienceAggregateRoot\\:\\:registerVideoCompletion\\(\\) has invalid type App\\\\Domain\\\\Experience\\\\Commands\\\\RegisterVideoCompletion\\.$#"
count: 1
path: app/Domain/Experience/ExperienceAggregateRoot.php

-
message: "#^Access to an undefined property App\\\\Domain\\\\Shop\\\\Models\\\\Purchasable\\:\\:\\$originalPurchasable\\.$#"
count: 2
Expand Down

0 comments on commit 86044fe

Please sign in to comment.