new SubDistrictSet - jcobban/Genealogy GitHub Wiki
new SubDistrictSet($parms)
The constructor for an instance of SubDistrictSet takes one parameter:
| parameter | description |
|---|---|
| $parms | identifies the database records to be associated with this instance. This is an array. |
$parms may be:
- an associative array of
fieldname => value pairsto define the subset of the records in the SQL table that are represented by this instance. - an array of instances of the class SubDistrict 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 | synonyms |
|---|---|---|
| 'sd_census' | an instance of class Census or the unique string identifier of an instance of class Census | 'census', 'censusid' |
| 'sd_distid' | an instance of class District or the unique identified of an instance of class District within the specified Census. | 'dist', 'distid', 'district' |
| 'sd_id' | the identifier of an enumeration division, or set of enumeration divisions within a town, township, or city ward. | 'id', 'sdid', 'subdist', 'subdistid', 'subdistrict' |
| '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 SubDistrict |
|
| 'groupby' | value of the GROUP BY clause |
For example:
$getparms = array('sd_census' => $census,
'sd_distid' => $distid);
$subdistricts = new SubDistrictSet($getparms);
$retval .= "<subdistricts count='" . $getparms['count'] . "'>\n";
foreach($subdistricts as $subdistrict)
{ // loop through subdistricts
$retval .= $subdistrict->toXml('subdistrict', false);
} // loop through subdistricts
$retval .= "</subdistricts>\n";
returns all instances of SubDistrict for the specified district.
The constructor adds error messages to $record->msg if it is unable to complete due to bad parameters.
Next: class Surname