Hello everyone. I'm having an issue creating a working database and saving
form information in the Zend Framework.
The way that I have the core files setup is as follows:
application
/modules
/register
/controllers
- IndexController.php
/ models
- *Register.php*
- *UserMapper.php*
//DbTable/
*- User.php*
Now, the way this is setup is that Register.php saves the form information
to variables. UserMapper.php acts as a middleman and saves the info in
Register.php to the db table User.php. So therefore User.php extends
Zend_Db_Table_Abstract.
Now I originally thought that if I defined my db adapter parameters in the
application.ini file, each object of type Zend_Db_Table_Abstract would
automatically look for this connection and use it to save to the db tables.
Apparently I was wrong and that's when I got the error.
So upon further reading of the manual, I read that you have to /*tell the
environment*/ that each instantiation of Zend_Db_Table_Abstract is going to
use a specific db adapter. So in my Bootstrap.php I used:
protected function _initDbAdapter{
$db = Zend_Db::factory('PDO_MYSQL', array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => ''
));
Zend_Db_Table_Abstract::setDefaultAdapter($db);
}
..and I still get the same error. Any explanation on this is greatly
appreciated.
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/No-adapter-found-for-Zend-Db-Table-Error-tp4658934.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]