Ayuda controlador

tengo este controlador pero al llamar las funciones success_response y error_response me sale error "No se pude llamar la funcion success_response de indefinida" Gracias


<?php

    class SignupController extends BaseController{

        public function registerAction(){

            if ($this->request->isPost()){
                $user = new Users();

                $name = $this->request->getPost("name");
                $last_name = $this->request->getPost("last_name");
                $email = $this->request->getPost("email");
                $password = $this->request->getPost("password");

                $user->name = $name;
                $user->last_name = $last_name;
                $user->email = $email;
                $user->password = $password;

                if($user->save()){
                    success_response($user);
                }
                else{
                    $error = "Error not save user in db";
                    error_response($error);
                }
            }
            else{
                $error = "Not request permited";
                error_response($error);
            }
        }

        protected function success_response($data){
            $success_array = array("success" => true,
                                   "data" => $data);

            echo json_encode($success_array);
        }

        protected function error_response($error){
            $error_array = array("success" => false,
                                 "error" => $error);

            echo json_encode($error_array);
        }
    }

?>```

Como error_response y success_response son m├ętodos del controlador debes usar $this para llamar esas funciones:

$this->success_response($user);
$this->error_response($error);

Muchas gracias :D