C
C
ColdSpirit2015-06-29 21:32:09
Yii
ColdSpirit, 2015-06-29 21:32:09

Yii - through relation, forms. How to implement?

I'm completely confused, my head doesn't work, I can't save data to other models - I just don't understand what needs to be done.
Here I described how the models are made - another question . Please answer it too.
In general, I could not save the data in the PageCategoryPivot model, because I do not understand how to put it in the form (display the data by default), and then get new data and save it. With grief on the floor, I managed to edit the article (definitely not according to Feng Shui), but if you use the same form to create an article, it gives incomprehensible errors like

Fatal error: Call to a member function getErrors() on a non-object in C:\OpenServer\domains\framework\web\helpers\CHtml.php on line 2199

I think this is because when creating a model, a pure model is created, without a "pivot" connection, and it no longer fits the form where the data is displayed, so far, for the test, pivot-> cat_id. Although there may be other reasons.
Please tell me what should I do with this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-06-01
@webinar

1. Why yii1 and not yii2?
2. Error with getErrors() because CHtml has no such method. We need to use activeForm to create validated forms.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question