I'm got Exception 'Failed to create the object for unknown reason.'
$model->save() == false
and
$model->hasErrors() == false
In what situations can it be?
This is magic of Yii2? We don't know what happend
look beforeValidate
should return true if valid
@psfpro this exception throwed in one place: https://github.com/yiisoft/yii2/blob/495553616dc41b9a5db141931388d9502d19eb13/framework/rest/CreateAction.php#L56
Please ensure what you model has rules() for attributes required by DB and Yii::$app->getRequest()->getBodyParams()
has model attributes.
For debug you may dump $model after load in yii/rest/CreateAction.php
_This is an automated comment, triggered by adding the label question
._
Please note, that the GitHub Issue Tracker is for bug reports and feature requests only.
We are happy to help you on the support forum, on IRC (#yii on freenode), or Gitter.
Please use one of the above mentioned resources to discuss the problem.
If the result of the discussion turns out that there really is a bug in the framework, feel free to
come back and provide information on how to reproduce the issue. This issue will be closed for now.
Most helpful comment
look
beforeValidate
should return true if valid