- WIP on entity save
This commit is contained in:
1 parent
5bd60129ea
commit
d12623cc5e
5 files changed
+33
-220
No files matched your search
@@ -19,6 +19,21 @@ class EntityCollection extends \ArrayObject {
|
||||
}
|
||||
}
|
||||
|
||||
public function searchOne($value, string $field) : object
|
||||
{
|
||||
# Returning first value only
|
||||
foreach($this->search($value, $field) as $item) {
|
||||
return $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function search($value, string $field) : Generator
|
||||
{
|
||||
foreach($this->filters(fn($v) => $v->$field === $value) as $item) {
|
||||
yield $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function buildArray(string $keyColumn, string $valueColumn) : array
|
||||
{
|
||||
$list = [];
|
||||
|
||||
Reference in new issue
Block a user