-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to validate related record without saving? #137
Comments
if ($model->loadAll(Yii::$app->request->post())) { |
@cgernert I may not be clear enough, thus I will explain better. $model->saveAll(); |
With loadAll() you already loaded them from POST. But I am afraid you have to iterate the rel. entity manually :
You do not have to iterate all $model->getRelatedRecords() if you have a $model->specificThings in mind and get rid of the outer foreach loop. |
Thanks for your help! I appreciated a lot, though a method like validateAll() would be more convenient for all scenarios. |
Using the main structure we have
if ($model->loadAll(Yii::$app->request->post()) && $model->saveAll()) {
but to me I should first validate all the related records do some stuff and then saveAll()
is there any way to validate related records without saving ?
The text was updated successfully, but these errors were encountered: