Zurmo(十一)Relation之static::OWNED和NOOWNED

来源:互联网 发布:numpy攻略 源码 编辑:程序博客网 时间:2024/04/30 02:35

对以前的一篇文章的补充:
http://blog.csdn.net/tyrannoaurus/article/details/54138464

关于model 里的relation里 static::OWNED和NOOWNED参数描述:

这里拿 account 模块 的account model来举例,示例如下:

'relations' => array(            'billingAddress'   => array(static::HAS_ONE,                                            'Address', static::OWNED,                                      static::LINK_TYPE_SPECIFIC, 'billingAddress'),)

static::OWNED 这个参数表示删除一条 account 的数据的时候,customFields 字段所关联其它表数据都会被删掉,如何这个参数设置成static::NOOWNED,customFields 字段所关联其它表数据则不会被删掉。

参数如何设置就看自己的业务需求了。

如有不对,请指正!

0 0