Custom rowsetClass does not return values
- by Wesley
Hi,
I'm quite new to Zend and the database classes from it. I'm having problems mapping a Zend_Db_Table_Row_Abstract to my rows.
The problem is that whenever I try to map it to a class (Job) that extends the Zend_Db_Table_Row_Abstract class, the database data is not receivable anymore. I'm not getting any errors, trying to get data simply returns null.
Here is my code so far:
Jobs:
class Jobs extends Zend_Db_Table_Abstract {
protected $_name = 'jobs';
protected $_rowsetClass = "Job";
public function getActiveJobs()
{
$select = $this->select()->where('jobs.jobDateOpen < UNIX_TIMESTAMP()')->limit(15,0);
$rows = $this->fetchAll($select);
return $rows;
}
}
Job:
class Job extends Zend_Db_Table_Row_Abstract {
public function getCompanyName()
{
//Gets the companyName
}
}
Controller:
$oJobs = new Jobs();
$aActiveJobs = $oJobs->getActiveJobs();
foreach ($aActiveJobs as $value) {
var_dump($value->jobTitle);
}
When I remove the "protected $_rowsetClass = "Job";" line, so that the table row is not mapped to my own class, I get all the jobTitles perfectly. What am I doing wrong here?
Thanks in advance,
Wesley