find elements by set

This commit is contained in:
Yisroel Baum 2026-05-25 08:12:50 +03:00
parent aaa494afe4
commit b44830fa53
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 12 additions and 6 deletions

View file

@ -2,6 +2,7 @@
namespace App\Element;
use App\Set\Set as DomainSet;
use App\Set\SetRepository;
use DomainException;
@ -35,9 +36,11 @@ class EloquentElementRepository implements ElementRepository
/**
* @return Element[]
*/
public function findBySetId(int $id): array
public function findBySet(DomainSet $set): array
{
$models = ElementModel::where('set_id', $id)->orderBy('id')->get();
$models = ElementModel::where('set_id', $set->getId())
->orderBy('id')
->get();
$elements = [];
foreach ($models as $model) {
$elements[] = $this->toDomain($model);