Cakephp Error: An internal error has occurred

Amit Chowdhury picture Amit Chowdhury · Nov 30, 2013 · Viewed 32.4k times · Source

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?

Answer

Amit Chowdhury picture Amit Chowdhury · Nov 30, 2013

I enabled debug mode: Configure::write('debug', 2); in core.php and it solved my problem.