Symfony1 自定义寻呼机/formfilter/buildquery不';t进程将数据过滤到查询中
我有一个操作需要使用formfilter、pager和特定的表方法:Symfony1 自定义寻呼机/formfilter/buildquery不';t进程将数据过滤到查询中,symfony1,doctrine,pager,Symfony1,Doctrine,Pager,我有一个操作需要使用formfilter、pager和特定的表方法: $this->filterForm = new OrganisationFormFilter(); $this->filterForm->setTableMethod('retrieveMemberOrganisations'); $this->filterForm->bind($searchParams); $v = $this->filterForm->getValues(); $
$this->filterForm = new OrganisationFormFilter();
$this->filterForm->setTableMethod('retrieveMemberOrganisations');
$this->filterForm->bind($searchParams);
$v = $this->filterForm->getValues();
$q = $this->filterForm->buildQuery($v);
$this->pager = new sfDoctrinePager('Organisation', 50);
$this->pager->setQuery($q->orderBy(implode(' ',$this->getSort())));
$this->pager->setPage($request->getParameter('page',1));
$this->pager->init();
public function retrieveMemberOrganisations(Doctrine_Query $q){
$rootAlias = $q->getRootAlias();
$q->
select("$rootAlias.*")->
addSelect('m.id, sc.id, cat.id, cat.number_key')->
innerJoin ("$rootAlias.CurrentMember c")->
innerJoin ("$rootAlias.Membership m")->
innerJoin ('m.LatestMembership lm')->
innerJoin ('m.MembershipSubcategory sc')->
innerJoin ('sc.MembershipCategory cat');
return $q;
}
问题是根本没有处理过滤器设置。我检查了$v中的值是否已设置,但它们似乎没有反映在$q中。此外,当我在RetrieveMemberOrganizations条目上使用调试器停止时,$q也不会在过滤器设置中出现。这是我使用的正确的代码顺序吗?我实际上使用formFilter来做类似的事情。而不是使用
$q = $this->filterForm->buildQuery($v);
使用
我没有使用setTableMethod方法,但我认为这应该有效
$q = $this->filterForm->getQuery();