Extended Zend_Db_Table_Row_Abstract does not return values
Posted
by WesleyE
on Stack Overflow
See other posts from Stack Overflow
or by WesleyE
Published on 2010-06-15T20:48:01Z
Indexed on
2010/06/15
21:42 UTC
Read the original article
Hit count: 188
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 for this row (Is on another table), just for example
}
}
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
© Stack Overflow or respective owner