I am trying to create my own MySQL queries in Cakephp.
This is my LocationsController.php
:
The class name of your Location model should be Location
, not LocationModel
.
Because of this, CakePHP will generate a 'generic' model for the Locations database table and use that model instead of your own model. Because this generic model does not have a get()
method, it will execute get
as a SQL statement, causing the error
Also, inside the Model, you should not use $this->Location->query();
, but simply $this->query();