new Birth - jcobban/Genealogy GitHub Wiki

new Birth($parms)

Up: class Birth

The constructor for an instance of Birth takes one parameter:

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

$parms may be:

  • An associative array containing all of the fields in a record as obtained by a database SELECT.
  • An associative array of parameters to uniquely identify a record. In particular specify values for 'regdomain', 'regyear', and 'regnum'. The value of 'regdomain' may be a string but it is more efficient to pass an existing instance of class Domain as this avoids unnecessarily creating a new instance of the class. This unique key is used by other records in the database to link to this particular record.

For example:

$Birth	= new Birth(array('domain' 	=> $domainObj,
			  'year'	=> $regYear,
			  'number'	=> $regNum));
  • For backwards compatibility this may also be specified at:
$Birth	= new Birth($domain, // or $domainObj
		    $regYear,
		    $regNum));

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

Next: $birth->set($fieldname, $value)