I am creating my second Zend Framework project (using 1.12) and have set it up just like the first (uses 1.11), but for some reason I am having problems connecting to my database using my class extending Zend_Db_Table. I have my database configuration in an ini file like this:
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "myUsername"
resources.db.params.password = "myPassword"
resources.db.params.dbname = "myDbname"
resources.db.isDefaultTableAdapter = true
Then I have my table class:
class Application_Model_DbTable_TestData extends Zend_Db_Table_Abstract {
protected $_name = 'testdata'
}
and then in my controller I try:
$testdata = new Application_Model_DbTable_TestData();
and then when I go to the view for that controller I just get the message Application Error
with no other info.
If I do the following in the controller:
$db = new Zend_Db_Adapter_Pdo_Mysql(array(
'host' => 'localhost',
'username' => 'myUsername',
'password' => 'myPassword',
'dbname' => 'myDbname'
));
$test = $db->select()->from(array('test' => 'testdata'));
I can get the data. Any ideas why I can't do it with the table class? As far as I can tell it's exactly the same as my other set up which works just fine.