Page::getLine - jcobban/Genealogy GitHub Wiki
$page->getLine($linenum)
Up: class Page
This method returns an instance of class CensusLine
if the specific line on the page has been transcribed. Otherwise it returns null
.
As with all constructors the constructor for class CensusLine
must return an object of that class, or throw an exception. This method provides a more graceful way to obtain an instance of CensusLine
only if it corresponds to a row in the transcription table.
Given that $page
is an instance of class Page you can either:
$line = $page->getLine($linenum);
if (is_null($line))
$msg = "$linenum is not present on this page. ";
or
$line = new CensusLine(array('Census' => $page['census'],
'District' => $page['distid'],
'SubDistrict' => $page['sdid'],
'Division' => $page['div'],
'Page' => $page['pagenum'],
'Line' => $linenum));
if (!$line->isExisting)
$msg = "$linenum is not valid. " . $line->getErrors();
Next: $page->isValid()