How to handle complex form with multiple models and tabular input in yii

两盒软妹~` 提交于 2019-12-07 18:56:29

I think you are looking for something like this: http://www.yiiframework.com/extension/eadvancedarbehavior/

This is an extension that does exactly that you asking.


Quoted from the link:

HAS_ONE and HAS_MANY

Suppose a User HAS_ONE Address and HAS_MANY Emails, and Address/Email BELONGS_TO User (both have the foreignkey column user_id).

So you can do now:

$blog = new Blog();    
$blog->author = $author; //the author model object
$blog->references = array( $references1, $references2, ... ) ; //reference model objects
$blog->save();

I think you understand how to setup the forms? Those links you send are pretty clear about it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!