Answer the question
In order to leave comments, you need to log in
How to organize a result handler?
Good afternoon!
I'm writing a library for working with API in ActiveRecord-style (well, roughly speaking :) Now I'm sorting out the answers.
The answer can be:
a) empty;
b) contain errors;
c) contain content.
Now I have implemented it rather clumsily, besides, it is impossible to read the error.
1. What should be the result handler ?
2. I want to send errors to the model as ActiveRecord, but it only works with attributes and you can’t write errors like that.
3. What if we just return a JsonResultHandler?
Answer the question
In order to leave comments, you need to log in
Who said that you can't write down mistakes just like that? choose any suitable word and write:
//например error
$this->addError('error', 'Error description');
//потом используете встроенные функции
if ($this->hasErrors('error')) {
var_dump($this->getErrors('error')); exit;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question