protected function getRecordObject($pk = null)
{
if ($this->_record === null) {
if ($pk !== null) {
$this->_record = $this->getRecordFinder()->findByPk($pk);
if ($this->_record === null) {
throw new TConfigurationException('scaffold_invalid_record_pk', $this->getRecordClass(), $pk);
}
} else {
$class = $this->getRecordClass();
if ($class !== null) {
$this->_record = Prado::createComponent($class);
} else {
throw new TConfigurationException('scaffold_invalid_record_class', $this->getRecordClass(), $this->getID());
}
}
}
return $this->_record;
}