new Address - jcobban/Genealogy GitHub Wiki

new Address($parms)

Up: class Address

The constructor for an instance of Address 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('idar' => integer) specifies the unique numeric key of the record in the table that is to be used to initialize the new instance. This unique key is used by other records in the database to link to this particular record. Specifically the Event, Family, Person, Picture, Source, and ToDoEntry classes have fields containing references to instances of class Address. The lowest value for 'idar' is 1, which is the numeric key of a reserved blank address record.
  • array('addrname' => string) specifies the textual name of the record in the table of Addresses. That is an instance for which the field AddrName matches the supplied value. Since the database definition does not guarantee that the value of AddrName is unique within the table, this associates to the instance with the lowest value of the numeric key IDAR. If there is no existing record in the table matching the supplied name, then a new record is created when $this->save() is called with the default kind of Address::REPOSITORY.
  • array('addrname' => string, 'kind' => Address::<constant>) to restrict the search for the record with matching name and kind and the lowest idar value, or to create a new record with the specified name and kind of address.

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

Next: $address->getIdar()

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