- WIP on entity save
This commit is contained in:
1 parent
5bd60129ea
commit
d12623cc5e
5 files changed
+33
-220
No files matched your search
+17
-7
@@ -26,21 +26,21 @@ class Repository
|
||||
$this->entityResolver = Ulmus::resolveEntity($entity);
|
||||
}
|
||||
|
||||
public function loadOne() : EntityCollection
|
||||
public function loadOne() : ? object
|
||||
{
|
||||
return $this->limit(1)->collectionFromQuery();
|
||||
return $this->limit(1)->collectionFromQuery()[0] ?? null;
|
||||
}
|
||||
|
||||
public function loadFromPk($value, $primaryKey = "id") : ? object
|
||||
{
|
||||
return $this->where($primaryKey, $value)->loadOne();
|
||||
}
|
||||
|
||||
public function loadAll() : EntityCollection
|
||||
{
|
||||
return $this->collectionFromQuery();
|
||||
}
|
||||
|
||||
public function loadFromPk($value, $primaryKey = "id") : EntityCollection
|
||||
{
|
||||
return $this->where($primaryKey, $value)->loadOne();
|
||||
}
|
||||
|
||||
public function loadFromField($field, $value) : EntityCollection
|
||||
{
|
||||
return $this->where($field, $value)->collectionFromQuery();
|
||||
@@ -61,6 +61,16 @@ class Repository
|
||||
return $this->where($primaryKey, $value)->deleteOne();
|
||||
}
|
||||
|
||||
public function save(object $entity) : bool
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function saveAll(EntityCollection $collection) : bool
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function yieldAll() : \Generator
|
||||
{
|
||||
|
||||
|
||||
Reference in new issue
Block a user