collection_class
Differences
This shows you the differences between two versions of the page.
collection_class [2020/02/17 09:58] – created sahl | collection_class [2020/02/17 10:29] (current) – sahl | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== Basic usage ===== | ===== Basic usage ===== | ||
- | Usually the Collection is the result of using the [[class_filter|Filter]] object, but it can be spawned on its own, passing a Datarecord or an array of Datarecords into the constructor, | + | Usually the Collection is the result of using the [[filter_class|Filter]] object, but it can be spawned on its own, passing a Datarecord or an array of Datarecords into the constructor, |
<code php> | <code php> | ||
Line 14: | Line 14: | ||
A datarecord can only contain objects of the same type and will adapt to the first object it receives. | A datarecord can only contain objects of the same type and will adapt to the first object it receives. | ||
- | The collection can be sorted by a specific field using '' | + | The collection can be sorted by a specific field using '' |
<code php> | <code php> | ||
$collection-> | $collection-> | ||
- | foreach ($collection-> | + | foreach ($collection as $user) { |
echo $user-> | echo $user-> | ||
} | } | ||
+ | </ | ||
+ | There are also some more sofisticated get-functions such as getting the value of a single field from the objects in the collection | ||
+ | |||
+ | <code php> | ||
foreach ($collection-> | foreach ($collection-> | ||
echo $value; | echo $value; | ||
} | } | ||
</ | </ | ||
+ | |||
+ |
collection_class.1581933483.txt.gz · Last modified: 2020/02/17 09:58 by sahl