find elements by set
This commit is contained in:
parent
aaa494afe4
commit
b44830fa53
3 changed files with 12 additions and 6 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue