User Tools

Site Tools


datarecordcollection_class

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
datarecordcollection_class [2019/10/09 21:06] sahldatarecordcollection_class [2020/02/17 09:58] (current) – removed sahl
Line 1: Line 1:
-====== DatarecordCollection class ====== 
  
-The primary purpose of this class is to keep a number of Datarecords bundled together. In addition to convenience, this can also speed things up when using the reference-fields in the Datarecord class as information for all contained Datarecord objects can be queried at the same time. 
- 
-===== Basic usage ===== 
- 
-Usually the DatarecordCollection 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, or adding it later using the add function. 
- 
-<code php> 
-$collection = new DatarecordCollection($user); 
-$collection->add($another_user); 
-</code> 
- 
-A datarecord can only contain objects of the same type and will adapt to the first object it receives.  
- 
-The datarecord can be sorted by a specific field using ''sort'' and data can be retrieved using the different get-functions, such as: 
- 
-<code php> 
-foreach ($collection->getAll() as $user) { 
-    echo $user->full_name; 
-} 
- 
-foreach ($collection->getAllFullValues('full_name') as $value) { 
-   echo $value; 
-} 
-</code> 
datarecordcollection_class.1570655164.txt.gz · Last modified: 2019/10/09 21:06 by sahl

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki