I’m developing a web app using a cakephp. I’ve one function in which I want to save some data to the model using cakephp’s save() method. But whenever I’m going to save the data I’m getting this kind of error:
Fatal error: Call to undefined method App::save() in /httpdocs/MyApp/app/Controller/AppsController.php on line 71
Anyone know what I’m missing here. My controller’s function is as below:
public function add_app($id=null){
$this->layout = 'user';
if (!empty($id)) {
$this->request->data['App']['id_users'] = $_SESSION['edit_user_id'];
$this->request->data['App']['id_store'] = $id;
$this->request->data['App']['id_unique_app'] = $Guid;
$this->request->data['App']['tx_app_name'] = $data['results'][0]['trackName'];
$this->request->data['App']['tx_platform'] = 'iOS';
$this->request->data['App']['nu_price'] = $data['results'][0]['price'];
$this->request->data['App']['da_created'] = date("Y-m-d H:i:s");
if ($this->App->save($this->request->data)) {
$this->Session->setFlash('The selected app has been added successfully.');
$this->redirect(array('action' => 'index'));
}
}
}
thanks in advance.
Try
instead of