So here is my method in my controller:
private $_tables = array();
private function _getTable($table)
{
if (!isset($this->_tables[$table])) {
include APPLICATION_PATH . '/modules/'
. $this->_request->getModuleName() . '/models/' . $table . '.php';
$this->_tables[$table] = new $table();
}
return $this->_tables[$table];
}
I use it like this in controller actions:
public function pageAction()
{
$request = $this->getRequest();
$pages = $this->_getTable('Pages');
$p = $pages->getSingle($request->getParam('id'));
$pages->viewIncrement($p->id);
$this->view->headTitle($p->title
. ' - Some cool title');
$this->view->p = $p;
}
It works fine on the local host when testing on my PC. It also worked on my old web hosting, but recently I moved my ZF applications to a new web hosting provider, and when I view some pages I get this error:
Method "_getTable" does not exist and was not trapped in __call()
That everything that was displayed is nothing more. Some pages work, and some show this error, so I'm completely lost. What could be the problem?
All necessary PHP extensions are installed and configured correctly, the database connection is working fine (as some pages work fine). I really have no idea. If at least the error was more descriptive.