Answer the question
In order to leave comments, you need to log in
Yii2 need forms for RESTful API?
Hello.
How many forms are needed when working with RestApi in Yii2? I still have the Zend ideology, although I have been writing on Yii1 for a year now.
There, forms were needed to build html and validate data before sending it to the database.
In Yii, the ideology is different, validation is implemented both in ActiveRecord and in Forms. And if we do not have the construction of html forms, then the forms are essentially not needed. ActiveRecord does a pretty good job with both validation and storage per se. Is it so?
The only reason why forms (and in fact a model with validation) may be needed is for custom validation of some parameters that will not be saved to the database later.
Do I have the right way of thinking in terms of Yii2?
Answer the question
In order to leave comments, you need to log in
what is ActiveRow?
why form for api?
validation occurs in the $model->validate() method, but not in the form.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question