new CensusLineSet - jcobban/Genealogy GitHub Wiki

new CensusLineSet($parms)

Up: class CensusLineSet

The constructor for an instance of CensusLineSet takes one parameter:

parameter description
$parms identifies the database records to be associated with this instance. This is an associative array.
$fields a string that specifies the set of fields to be extracted. The default is '*' which specifies all of the fields in the table. This must be specified if $parms includes 'censusid'=> 'CAALL'.

$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.
  • The parameter can also be an array of instances of the class CensusLine to be converted into a RecordSet.
  • If this parameter is omitted, or null, the object is empty. That is $set->count() is zero.

The field names in the array $parms are interpreted as follows:

field name action
censusid The parameter 'censusid' is mandatory. It must be either the identifier of a specific census, the special code 'CAALL' which searches all of the Canadian censuses, or an instance of class Census.
province either a string representing a single state or province code or an array of strings identifying multiple state or province codes any of which can match. The code 'ON' is interpreted as either 'ON' or 'CW'. The code 'QC' is interpreted as either 'QC or 'CE'.
district either a value identifying a single district or an array identifying multiple districts.
subdistrict either a value identifying a single sub-district, a string of comma-separated values, or an array of values identifying multiple sub-districts. If this is specified then the 'district' parameter must identify a single district.
division either a value identifying a division, or a string "district: sub-district".
page page identifier
range numeric range in years of age or birth year
family family identifier
surname if a simple string then records whose surname matches the pattern associated with the surname are included. If the string starts with a caret '^' and ends with a dollar sign '$' then it specifies an exact match for surname. If the strings starts with a caret but does not end with a dollar sign then it specifies a match for the leading characters of the surname.
surnamesoundex include records whose SOUNDEX code, using the algorithm defined by SQL, matches the value.
givennames a string value, which may be a comma-separated list of values, or an array. Any individual with a given name that begins with the supplied value or values is included.
byear birth year. This is compared to the calculated birth year from the census record within the range specified by the 'range' parameter.

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

Next: $lineset->getDistrict()