I am using the version Cakephp 2.9.3 and when I am saving the data by using save method of the model, the data is being saved twice in my database table but I have checked that the save call is triggered only once.
Here is the code for my Controller:
App::uses('AppController', 'Controller');
App::uses('Log', 'Model');
class DashboardController extends AppController {
public function index() {
$data = array(
'type' => 'subscribers_log',
'message' => 'sample text',
'ip' => '127.0.0.1',
'hostname' => 'finakle.com',
'uri' => '/'
);
$log = new Log;
$log->save($data);
}
}
Here is the sample screenshot of my database table:
I had built a custom layout for the application and further analyzed that in my layout file I was playing a video file using normal HTML tags. This somehow was causing the issue. Below mentioned is the code:
But then I changed the code to include the video file through cakephp media tag as shown below:
This resolved my issue.