I would like to be able to user sfPropelPager with sfGuard's user ta开发者_运维知识库ble.
I can do the following just fine:
$c = new Criteria();
$c->addAscendingOrderByColumn(sfGuardUserPeer::CREATED_AT);
$this->users = sfGuardUserPeer::doSelect($c);
But I cannot do:
$pager = new sfPropelPager('sf_guard_user', 20);
$pager->setPage($this->getRequestParameter('page', 1));
$c = new Criteria();
$c->addAscendingOrderByColumn(sfGuardUserPeer::CREATED_AT);
$pager->setCriteria($c);
$pager->setPeerMethod('doSelect');
$pager->init();
$this->users = $pager;
Am I doing something painfully stupid here?
I haven't used propel for a while, but as I remember, you should put the class name in the constructor, not the table name - so instead of sf_guard_user
try it with sfGuardUser
. The class itself is in plugins/sfGuardPlugin/lib/model
.
精彩评论