开发者

* @method Users setGroups() Sets the current record's "Groups" collection

I would like set null in all fields in one user. If this is simple fields, for example:

* @method Users             setNumber()                 Sets the current record's "number" value

then i make:

$user = $query;
$user->setNumber(NULL);
$user->save();

this working ok, but i would like add for this

* @method Users            setGroups()            Sets the current record's "Grou开发者_如何学编程ps" collection

but if i make:

$user = $query;
$user->setNumer(NULL);
$user->setUsers(NULL);
$user->save();

i have error:

Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Collection when setting many-to-many references.

how must be the second argument for this?


$user['Groups'] = new Doctrine_Collection('Group');

i.e. you're making the value an empty collection of Group objects

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜