How to call a model function insider another controller in cakephp

175 views Asked by At

i have my controller function like this:

private function _send_refund_scores($userId,$scores,$orderId){
            $this->loadModel('Score');
            $rtn = $this->Score->refund_user_scores($userId,$scores,$orderId);
            if(!empty($rtn)){
                return true;
            }else return false;
}

while in another model Score , I have model function refund_user_scores;

the error like this:

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 'refund_user_scores' at line 1

so,any idea?

1

There are 1 answers

3
PHP Worm... On

I guess you have defined refund_user_scores() as a private function in model Score.

That is why you are getting this error.