Merge branch 'master' of https://git.mcnd.ca/mcndave/ulmus
This commit is contained in:
commit
f77c93ad20
19 files changed
+114
-57
No files matched your search
+10
-4
@@ -65,7 +65,7 @@ class Repository
|
||||
return $primaryKey ? $this->loadOneFromField($primaryKey, $value) : $this->wherePrimaryKey($value)->loadOne();
|
||||
}
|
||||
|
||||
public function loadAll() : EntityCollection
|
||||
public function loadAll () : EntityCollection
|
||||
{
|
||||
return $this->selectSqlQuery()->collectionFromQuery();
|
||||
}
|
||||
@@ -541,7 +541,7 @@ class Repository
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function orderBy(string|\Stringable $field, ? string $direction = null) : self
|
||||
public function orderBy(string|object $field, ? string $direction = null) : self
|
||||
{
|
||||
$this->queryBuilder->orderBy($field, $direction);
|
||||
|
||||
@@ -559,7 +559,13 @@ class Repository
|
||||
public function orders(array $orderList) : self
|
||||
{
|
||||
foreach($orderList as $field => $direction) {
|
||||
$this->orderBy($field, $direction);
|
||||
if (is_numeric($field)) {
|
||||
$this->orderBy($direction);
|
||||
}
|
||||
else {
|
||||
# Associative array with direction
|
||||
$this->orderBy($field, $direction);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -599,7 +605,7 @@ class Repository
|
||||
|
||||
$pkField = key($primaryKeyField);
|
||||
|
||||
return $this->where($primaryKeyField[$pkField]->name ?? $pkField, $value);
|
||||
return $this->where($this->entityClass::field($primaryKeyField[$pkField]->name ?? $pkField), $value);
|
||||
}
|
||||
|
||||
public function withJoin(string|array $fields, array $options = []) : self
|
||||
|
||||
Reference in new issue
Block a user