Call to undefined method Error::save()

Hi, I have this error when I try to save data with the model "Error", other models like "member" save fine, but this always return error. Someone to help? Error: Call to undefined method Error::save()

        if (!$member->save()) {

            foreach ($member->getMessages() as $message) {

                $error = new Error();
                $error->Message = $message->getMessage();
                $error->Controller = $this->dispatcher->getControllerName();
                $error->Action = $this->dispatcher->getActionName();

                $error->save();  // here is the error
            }

        } else {

            return json_encode($this->response);
            exit;
        }

Are You sure it's Phalcon Model?

See what

echo get_class($error);

would show.

Yes. it is a Phalcon model. the echo return the name of the model "Error"



1.6k

Replace

$error->save()

with

if (!$error->save()) {
    die(var_dump($error->getMessages()));
}

Replace

$error->save()

with

if (!$error->save()) {
  die(var_dump($error->getMessages()));
}

Dont think it'll work



1.6k

For debugging purposes

Replace

$error->save()

with

if (!$error->save()) {
 die(var_dump($error->getMessages()));
}

Dont think it'll work