new Person - jcobban/Genealogy GitHub Wiki
new Person($parms)
Up: class Person
The constructor for an instance of Person 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.
- null to create a new record.
array('id' => integer)
specifies the unique internal numeric key of the record in the table that is to be used to initialize the new instance. This internal identifier is inherited from Legacy Family Tree. It is maintained for compatibility but is not used by this implementation.array('idir' => integer)
specifies the unique external numeric key of the record in the table that is to be used to initialize the new instance. This is the key used by other records to refer to an instance of Person. Note that this is not an auto-increment key as implemented by the MySQL or MariaB server. For a new instance of Person the value of the field 'idir' is set toCOALESCE(MAX(IDIR), 0) + 1
.array('idir' => instance of Name)
specifies to construct the instance with which the instance of class Name is associated.array('idir' => instance of Child)
specifies to construct the instance with which the instance of class Child is associated.
Examples:
$indiv = new Person();
Creates a new individual with all default values.$indiv = new Person(array('givenname' => 'John', 'surname' => 'Smith', 'gender' => Person::MALE, 'birthd' => '12 Apr 1856', 'deathd' => '23 Nov 1899'));
Creates a new individual with the specified name, gender and birth and death dates.$indiv = new Person(array('idir' => 1234));
Creates an instance from an existing record in the database.
The constructor adds error messages to $record->msg
if it is unable to complete due to bad parameters.
Next: Person::getPerson($idir)