* @method Users setGroups() 设置当前记录的“组”收藏
我想在一个用户的所有字段中设置 null。 如果这是简单的字段,例如:
* @method Users setNumber() Sets the current record's "number" value
那么我 make:
$user = $query;
$user->setNumber(NULL);
$user->save();
这个工作正常,但我想为此添加,
* @method Users setGroups() Sets the current record's "Groups" collection
但如果我 make:
$user = $query;
$user->setNumer(NULL);
$user->setUsers(NULL);
$user->save();
我有错误:
Couldn't call Doctrine_Core::set(), second argument should be an instance of Doctrine_Collection when setting many-to-many references.
第二个参数必须如何?
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 "Groups" 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即您将值设置为 Group 对象的空集合
i.e. you're making the value an empty collection of Group objects