bind($data); // save user $res = $user->save(); if (!$res) { // retrieve error from user instance and set it here // for being used by the subject that called this model $this->setError($user->getError()); return false; } // registration successful, return ID return $user->id; } }