new PageSet - jcobban/Genealogy GitHub Wiki

new PageSet($parms)

Up: class PageSet

The constructor for an instance of PageSet takes one parameter:

parameter description
$parms identifies the database records to be associated with this instance. This is an associative array.

$parms may be:

  • an associative array of fieldname => value pairs to define the subset of the records in the SQL table that are represented by this instance.
  • an array of instances of the class Page to be converted into a RecordSet.
  • If this parameter is omitted, or is null, the object is empty. That is $set->count() is zero.

The field names that may be specified in the associative array format include:

field name description
'limit' maximum number of entries to return
'offset' offset for retrieving part of the response set
'orderby' value of the ORDER BY clause to override the default from class DontMergeEntry
'groupby' value of the GROUP BY clause

The following examples show two ways to obtain a PageSet containing all of the instances of Page in a particular enumeration division represented by class SubDistrict:

$set	 = new PageSet(array('census'	=> 'CA1891',
			     'distid'	=> 89,	
		             'sdid'	=> 'A',	
			     'div'	=> '1',	
			     'sched'	=> '1'));
$subdistrict = new SubDistrict(array('census'	=> 'CA1891',
			             'distid'	=> 89,	
		                     'sdid'	=> 'A',	
			             'div'	=> '1',	
			             'sched'	=> '1'));
$pageset = new PageSet(array('sdid' => $subdistrict));

The constructor adds error messages to $record->msg if it is unable to complete due to bad parameters.

Next: class Person