new Surname - jcobban/Genealogy GitHub Wiki

new Surname($parms)

Up: class Surname

The constructor for an instance of Surname 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.
  • array('surname' => $surname) specifies the string surname value of the record in the table that is to be used to initialize the new instance.
  • For backwards compatibility if the parameter is a single string which is not all decimal digits it is interpreted as if it was passed as the value of the surname search parameter.

The surname string value may begin with a SQL comparison operator: '=', '<', '>', '<=', '>='. The default if this is not present is '='. For example if there are existing surname records for 'Bixell', 'Black', and 'Blackall' in the table and the remainder of the string after the operator is 'Black':

operator action
'=' The record with surname value matching the remainder of the string, ignoring case, is returned. If there is no record with that surname value then a temporary record is created for which the method $surname->isExisting() returns false. For example this returns the record for surname 'Black'.
'<' The first record whose surname value is less in the collating sequence than the remainder of the parameter is returned. For example this returns the record for surname 'Bixel'.
'>' The first record whose surname value is greater in the collating sequence than the remainder of the parameter is returned. For example this returns the record for surname 'Blackall'.
'<=' The first record whose surname value is less than or equal in the collating sequence than the remainder of the parameter is returned. If a record with the specified surname is present it is returned. For example this returns the record for surname 'Black'.
'>=' The first record whose surname value is greater than or equal in the collating sequence than the remainder of the parameter is returned. If a record with the specified surname is present it is returned. For example this returns the record for surname 'Black'.

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

Next: $surname->getName()

⚠️ **GitHub.com Fallback** ⚠️