Skip to content

Commit

Permalink
Object collections: Allow property get, set and grouping for nested a…
Browse files Browse the repository at this point in the history
…rrays
  • Loading branch information
mahagr committed May 16, 2017
1 parent 91a6224 commit 0269ec5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions system/src/Grav/Framework/Object/ObjectCollectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getProperty($property)
$list = [];

foreach ($this as $id => $element) {
$list[$id] = isset($element->{$property}) ? $element->{$property} : null;
$list[$id] = isset($element[$property]) ? $element[$property] : null;
}

return $list;
Expand All @@ -66,7 +66,7 @@ public function getProperty($property)
public function setProperty($property, $value)
{
foreach ($this as $element) {
$element->{$property} = $value;
$element[$property] = $value;
}
}

Expand Down Expand Up @@ -96,8 +96,9 @@ public function call($method, array $arguments = [])
public function group($property)
{
$list = [];

foreach ($this as $element) {
$list[$element->{$property}][] = $element;
$list[$element[$property]][] = $element;
}

return $list;
Expand Down

0 comments on commit 0269ec5

Please sign in to comment.