- WIP on entity save

This commit is contained in:
Dave Mc Nicoll committed 2020-01-31 16:38:48 -05:00
1 parent 5bd60129ea
commit d12623cc5e
5 files changed
+33 -220

No files matched your search

+15
View File
@@ -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 = [];