-
I already have an existing project with many tables so I can’t change their names.
I want to set up cake php to “hibernate” with the tables-
so lets say i have a table called:
“stock_realtime”
I have set up a model in Model->”StockRealtime.php”:class StockRealtime extends AppModel{
var $name = 'stock_realtime';}
and the controller is in Controller->”StocksRealtimeController.php”
class StocksRealtimeController extends AppController {
var $name = 'stock_realtime';
function index() {
$this->set('stocks', $this->StockRealtime->find('all'));
}
}
and the view in a View->stocks_realtime->index.ctp
I go to the view file and I get an error msg:
Error: Call to a member function find() on a non-object
File: C:\xampp\htdocs\s-maof-vb\stocksRT\app\Controller\StocksRealtimeController.php
For your model, add
var $useTable = 'stock_realtime';For your controller add
var $uses = 'StockRealtime';