【发布时间】:2012-05-23 15:41:07
【问题描述】:
我有 2 张桌子:
Profiles
------
id
Stats
------
profile_id
v1
v2
和 2 个模型:
Profile_Model
$_has_one = array( 'stat' => array() );
Stat_Model
$_belongs_to = array( 'profile' => array() );
我愿意:
$profile = ORM::Factory( 'profile', $id );
$profile->stat->v1 = 123;
$profile->stat->save();
我希望更新或创建具有 profile_id = $id 的 Stats 行。相反,它总是尝试插入记录,即使它存在(因为它认为该记录未加载)。
我该如何解决?
【问题讨论】:
标签: kohana-orm kohana-3.2