开发者

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

开发者 https://www.devze.com 2023-04-06 04:00 出处:网络
I would like set null in all fields in one user. If this is simple fields, for example: * @method UserssetNumber()Sets the current record\'s \"number\" value

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

精彩评论

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