The Product model is not your Product model
If you call a method on a model that doesn't exist, it gets passed to the db as a query:
$someModel->woopWoop(); // executes `woopWoop`
The error says:
Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'getData' at line 1
As such the model you are calling with getData
is not a model that has a method named getData.
Either you want to load a model from a plugin, but instead have an instance of AppModel; in which case you should do:
$this->loadModel('MyPlugin.Product');
Or the instance is of the correct class but it simply does not have the method getData
. You can check which by simply doing:
debug(get_class($this->Product)); // outputs e.g. "Product" or "AppModel"