Notice: Undefined variable: entryMessage in /var/www/Employee/application/models/EmployeeMapper.php on line 34 Fatal error: Call to a member function setEmployeeId() on a non-object in /var/www/Employee/application/models/EmployeeMapper.php on line 34
这是我遇到的错误,我尝试显示输入的字段,我检查了数据库并且字段正在保存,我正在发布员工映射器。请检查代码并告诉解决方案,提前致谢
class Application_Model_EmployeeMapper
{
protected $_dbTable;
public function setDbTable($dbTable)
{
if (is_string($dbTable)) {
$dbTable = new $dbTable();
}
if (!$dbTable instanceof Zend_Db_Table_Abstract) {
throw new Exception('Invalid table data gateway provided');
}
$this->_dbTable = $dbTable;
return $this;
}
public function getDbTable()
{
if (null === $this->_dbTable) {
$this->setDbTable('Application_Model_DbTable_Employee');
}
return $this->_dbTable;
}
public function fetchAll()
{
$table = $this->getDbTable();
$resultSet = $table->fetchAll($table->select()->order('EMPLOYEE_ID'));
$entries = array();
foreach ($resultSet as $row) {
$entry = new Application_Model_Employee();
$entryMessage->setEmployeeId($this->$row->EMPLOYEE_ID)
->setFirstName($row->FIRST_NAME)
->setLastName($row->LAST_NAME)
->setEmail($row->EMAIL)
->setPhoneNumber($row->PHONE_NUMBER)
->setHireDate($row->HIRE_DATE)
->setJobId($row->JOB_ID)
->setSalary($row->SALARY);
$entries[] = $entry;
}
return $entries;
}
public function save(Application_Model_Employee $employee)
{
$data = array(
'EMAIL' => $employee->getEmail(),
'FIRST_NAME' => $employee->getFirstName(),
'LAST_NAME' => $employee->getLastName(),
'PHONE_NUMBER' => $employee->getPhoneNumber(),
'HIRE_DATE' => $employee->getHireDate(),
'JOB_ID' => $employee->getJobId(),
'SALARY' => $employee->getSalary(),
);