【问题标题】:Using doctrines findBy/getBy magic methods with the pager object?对寻呼机对象使用学说 findBy/getBy 魔术方法?
【发布时间】:2010-09-20 02:14:19
【问题描述】:

sfDoctrinePager 是否可以使用学说魔法方法(在本例中为 findBy*)?我收到以下错误:

Call to undefined method Doctrine_Collection::offset()

代码如下:

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

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

【问题讨论】:

    标签: php doctrine pager


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-21
      • 1970-01-01
      • 1970-01-01
      • 2011-04-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多