将教义 findBy/getBy 魔术方法与寻呼机对象一起使用?

发布于 2024-09-24 10:15:34 字数 362 浏览 0 评论 0原文

是否可以将教义魔术方法(在本例中为 findBy*)与 sfDoctrinePager 一起使用?我收到以下错误:

Call to undefined method Doctrine_Collection::offset()

这是代码:

$this->pager->setQuery(Doctrine::getTable('notification')->findByUserId($this->getUser()->getGuardUser()->getId()));

我知道我可以自己构建一个查询,只是想知道是否可以使用“魔术”方法。

Is it possible to use doctrines magic methods (in this case findBy*) with sfDoctrinePager? I'm getting the following error:

Call to undefined method Doctrine_Collection::offset()

Here is the code:

$this->pager->setQuery(Doctrine::getTable('notification')->findByUserId($this->getUser()->getGuardUser()->getId()));

I know I can build a query myself just want to know if it's possible using the "magic" methods.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心凉 2024-10-01 10:15:34

不,你不能。 findby* 方法返回一个对象或对象数组。 sfDoctrinePager 只能作用于查询对象。

nope, you can't. the findby* methods returns an object or an array of objects. sfDoctrinePager can only work on query objects.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文