I have a controller called MCPController. I know this seems to go against Cakephp naming convention but
1) the name "MCPs" with the 's' did not make grammatical sense. So I left it as "singular"..
2) i don't actually have/need a Database table called MCP
This MCPController has an action "dayview" that calls a view called dayview.
In my dayview view I have the following code that creates a form:
echo $this->Form->create('MCP', array('formnovalidate' => true, 'controller'=>'MCP', 'action'=>'merchantonchange'));
echo $this->Form->input('MerchantAssignments', array('label' => 'Merchant Assignments',
'type' => 'select',
'options'=>$this->Session->read('Auth.MerchantAssignments'),
'default' => $this->Session->read('Auth.ActiveMerchant'),
'onChange' => 'this.form.submit()'));
echo $this->Form->end();
I get an error :
Error: Table m_c_ps for model MCP was not found in datasource default.
The error seems to be coming from the line with the "$this->Form->create" code, because taking away the Form->create seems to take the error away.
It seems to be expecting a table m_c_ps to exist in the database?
The form is meant to submit the new dropdown selection (via onchange event) back to the same Controller.
How can i fix this given that i don't actually have a table called m_c_ps ?
Stacktrace:
CORE\Cake\Model\Model.php line 3498 → Model->setSource(string)
CORE\Cake\Model\Model.php line 1355 → Model->getDataSource()
CORE\Cake\View\Helper\FormHelper.php line 207 → Model->schema()
CORE\Cake\View\Helper\FormHelper.php line 459 → FormHelper->_introspectModel(string, string)
APP\View\Layouts\default.ctp line 191 → FormHelper->create(string, array)
CORE\Cake\View\View.php line 935 → include(string)
CORE\Cake\View\View.php line 897 → View->_evaluate(string, array)
CORE\Cake\View\View.php line 529 → View->_render(string)
CORE\Cake\View\View.php line 474 → View->renderLayout(string, string)
CORE\Cake\Controller\Controller.php line 952 → View->render(null, null)
CORE\Cake\Routing\Dispatcher.php line 192 → Controller->render()
CORE\Cake\Routing\Dispatcher.php line 160 → Dispatcher->_invoke(MCPController, CakeRequest, CakeResponse)
APP\webroot\index.php line 108 → Dispatcher->dispatch(CakeRequest, CakeResponse)
Form->create('MCP')is the one that's causing trouble, because I've named my forms any way imaginable (without models) with no problem... Does the error appears on render? What happens if you comment absolutely everything that's on the controller part and just see what happens with the view part alone? Can you post the controller part for that view?