fix: reduce number of database queries caused by voter
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user