new CensusSet - jcobban/Genealogy GitHub Wiki
new CensusSet($parms)
Up: class CensusSet
The constructor for an instance of CensusSet
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. The parameters 'offset', 'limit', 'groupby',and 'order' are reserved to set the OFFSET, LIMIT, GROUP BY and ORDER BY clauses. - an array of instances of the class Census
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 are:
field name | description | synonyms |
---|---|---|
'censusid' | a single string or an array of strings | 'id', 'code' |
'cc' | an ISO 3166-1 two character country code | 'countrycode' |
'year' | the enumeration year | |
'name' | string pattern to match to census names | |
'linesperpage' | number of lines per page in original input form | |
'province' | province or state code within the country | 'state' |
'collective' | null, 0, or 1 | |
'partof' | null or ISO 3166-1 two character country code | |
'provinces' | null or exact match string | 'states' |
'limit' | maximum number of entries to return | |
'offset' | offset for retrieving part of the response set |
For example:
$censuses = new CensusSet(array('cc' => 'CA'));
returns all instances of Census
for Canada.
The constructor adds error messages to $record->msg
if it is unable to complete due to bad parameters.
Next: class Child