views:

31

answers:

3

have defined different models and modelMappers in my php project.

my folders are structured as follows

-application
--models
---DbTable
----modelName
---modelMapperName

modelName.php
class Application_Model_DbTable_ModelName extends Zend_Db_Table_Abstract{

}

modelMapper.php
class Application_Model_ModelMapper
{
}

everytime i try to access the values in my database by creating an instance of my mapper in the controller i get the message No adapter found for Application_Model_DbTable_ModelName

i thought this can be an issue with the autoloader and added the following code in the bootstrap,

$loader = new Zend_Application_Module_Autoloader(array(
'namespace' => 'Application',
'basePath' => APPLICATION_PATH
));

$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->setFallbackAutoloader(true);

return $loader;

but it still didnt work, can anyone help me figure out where i am going wrong?

thank you.

A: 

Since the variable APPLICATION_PATH returns de full path to your application folder try naming your classes only

Model_DbTable_ModelName
Jeff
A: 

This error it's related to database initialization...

You have to configure the database adapter in your application.ini:

resources.db.adapter            = "pdo_mysql"
resources.db.params.host        = "localhost"
resources.db.params.username    = "user"
resources.db.params.password    = "password"
resources.db.params.dbname      = "db"

Or you could also configure the database adapter in your bootstrap file:

$db = Zend_Db::factory("pdo_mysql", $params);
Zend_Db_Table::setDefaultAdapter($db);
rafeca
A: 

i found out that the variable i was trying to access didn't start with an underscore and also capitalization issues with the models created was causing the problem.

Thank you all for helping

abs