Hello people, I just read some old forum posts on Yii1 that Yii could generate a model from a view. Is this still possible in Yii2??
Does the AR also support update, insert or delete on the view given that it’s possible on the level of the database-server. I mean if the view can be updated on the database server does yii2 support this via the AR ?? Somebody experience with this in Yii2??
Functionality depends on underlying database.
If you need to update a view, the view needs to be updatable at the database level. Whether updatable depends on several factors, you can google the answer for your particular DB.
As far as generating models using Gii, I would assume it could but haven’t tried. It may choke on creation of the model due to a view not having a primary key. Try it out and let us know.
Thanks waitforit, I googled and did some reading about this and decided not to go this way. There are to many catches in updating the underlying tables of a view so I will stick to the proper/normal way and define the relations with the main-table. This makes the code more readable, future changes are easier to implement and less risk that the code will fail. To many uncertainties. In yii1 though it was possible to create a model from a view.