new CountryName - jcobban/Genealogy GitHub Wiki
new CountryName($parms)
The constructor for an instance of CountryName 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('cc' => countryCode, 'lang' => languageCode)
specifies the unique keys of the record in the table that is to be used to initialize the new instance. In this formcountryCode
may be either the a character string or an instance of Country, andlanguageCode
may be either a two character string or an instance of Language.
$name = new CountryName(array('cc' => 'US',
'lang' => 'it'));
print $name->getName();
The above requests creating an instance of CountryName with the Italian name of the United States of America. On 6 Apr 2019 there was no entry in the CountryNames table for the Italian name of the United States of America so the above would print "United States of America". If all you want is the name you may also do:
$usa = new Country(array('cc' => 'US'));
print $usa->getName('it');
The constructor adds error messages to $record->msg
if it is unable to complete due to bad parameters.
Next: $countryName->getName()