开发者

using setSfGuardUser() to save the current user in the model

My application makes use of the sfGuardUser plugin. One of my tables has a relation onto the sf_guard_user table so there is a corresponding setSfGuardUser() function in the base model. From Actions.class.php, I am attempting to set the current user into the object using this function, (Which I then save in the database).

my attempt:

->setSfGuardUser($this->getUser());  //called from inside Actions.class.php

this throws an error:

Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Record or Doctrine_Null when setting one-to-one references.

...# at Doctrine_Record->coreSetRelated('sfGuardUser', object('myUser'))

Which makes me think tha开发者_开发知识库t getUser() is not returning a sfGuardUser object, though I don't know how to check this. Can anyone offer any insight?


$this->getUser() returns a myUser instance. You need $this->getUser()->getGuardUser().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜