Person::getPerson - jcobban/Genealogy GitHub Wiki
Person::getPerson($idir)
Up: class Person
This is a static factory method for an instance of Person that takes one parameter:
parameter | description |
---|---|
$idir | the value of field 'idir' |
This returns a shared instance of class Person which is identified by the value of 'idir'
. This differs from new Person(array('idir' => $idir))
in that if the current application process has previously created an instance of class Person for that value of 'idir'
, either by calling Person::getPerson($idir)
or by new Person(array('idir' => $idir))
then Person::getPerson($idir)
returns that existing instance rather than creating a new instance.
This has two advantages:
- If the current thread has previously created an instance then this is much faster than creating a new entry, which would, among other things, require reading the record from the database again.
- If all parts of the application use Person::getPerson($idir) then all parts of the application will be using the same copy of the object and all changes made by any part of the application will be reflected when the instance is saved.
Next: $person->getPriName()