Record::set - jcobban/Genealogy GitHub Wiki

$record->set($field, $value)

Up: class Record

This method alters the current value of the field identified by the field name parameter and returns the previous value. It has two parameters:

parameter description
$field The field name is case insensitive and may be a synonym defined by the derived class to facilitate readability. Late static binding is used so this method takes advantage of field name definitions in the derived class. The field name may also be a temporary field defined by assigning a value to it in this method. This method creates a trace entry if the field name does not correspond to any field in the record and debugging is enabled.
$value The new value to assign to the field.

This method is called for $record[$field] on the left hand side of an assignment.

For example:

	$record->set('BaptismD', $date);
	$record->set('IDTRBaptism', $idlr);
	$record->set('BaptismKind', $kind);
	if (is_null($note))
	    $record->set('BaptismNote', '');
	else
	    $record->set('BaptismNote', $note);
	$record->set('LDSB', $templeReady);

However in my opinion the following is more intuitively understandable:

	$record['BaptismD']             = $date;
	$record['IDTRBaptism']          = $idlr;
	$record['BaptismKind']          = $kind;
	if (is_null($note))
	    $record['BaptismNote']      = '';
	else
	    $record['BaptismNote']      = $note;
	$record['LDSB']                 = $templeReady;

This method is generally overloaded in each of the derived classes but if the only additional functionality is validation of field values then the method is not documented.

Next: $record->isOwner()