fix: reduce number of database queries caused by voter

This commit is contained in:
Björn Fromme
2025-04-11 09:51:32 +02:00
parent 947b183c50
commit 24ffee7c0b
6 changed files with 38 additions and 15 deletions
+13
View File
@@ -464,6 +464,19 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
return $this;
}
public function getDispositionByTeamer(Teamer $teamer): ?Disposition
{
$dispositions = $this->dispositions->filter(function (Disposition $disposition) use ($teamer) {
return $disposition->getTeamer() === $teamer;
});
if (0 === count($dispositions)) {
return null;
}
return $dispositions->first();
}
public function getValidDispositions(): Collection
{
return $this->dispositions->filter(function (Disposition $disposition) {