I have some code in cakephp which produces an error.
Here is the PHP Controller:
$this->loadModel( 'Vote' ); //Newly added by amit start
$vote=$this->Vote->getVote($id,$uid);
$this->set('vote',$vote);
$voteCount = count($vote);
$this->set('voteCount',$voteCount);
$voteShow = $this->Vote->find('all', array(
'fields' => array('SUM(Vote.score) AS score','count(id) as countId'),
'conditions'=>array('Vote.type_id'=>$id),
));
$this->set('voteShow',$voteShow);
model:
public function getVote($id,$uid) {
if (empty($conditions))
$conditions = array('Vote.type' => 'blog',
'Vote.type_id' => $id,
'Vote.user_id' => $uid);
$users = $this->find('all', array('conditions' => $conditions,
'order' => 'Vote.id desc'
));
return $users;
}
That code produces this error:
Error : An internal error has occurred
What does this error mean?
I enabled debug mode: Configure::write('debug', 2);
in core.php and it solved my problem.
In my case debug mode was
Configure::write('debug', 0);
on live server in core.php.
I set it to Configure::write('debug', 1);
and no error was shown this time.
So I again changed my debug mode to Configure::write('debug', 0);
because I don't want to show debug error on my live site.
This time no error message shows up.
So just changing the debug mode once in core.php get rid of this error in my case.
If you change your debug mode to 1 and then run those functions which you have changed on local, CakePHP will refresh the cache for all those models which include in those functions. Now you can change back to Configure::write('debug', 0)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With