Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix total_items and total_pages in Paginator when it has GROUP BY #2411 #11195

Merged
merged 1 commit into from
Dec 12, 2015
Merged

Conversation

ryomo
Copy link
Contributor

@ryomo ryomo commented Dec 5, 2015

@sergeyklay
Copy link
Contributor

@andresgutierrez Test for PHP 5.3 fails because zephir-lang/zephir#1139

@sergeyklay sergeyklay closed this Dec 6, 2015
@sergeyklay sergeyklay reopened this Dec 6, 2015
@sergeyklay
Copy link
Contributor

@andresgutierrez Now tests fails because zephir-lang/zephir#1141

@sergeyklay sergeyklay closed this Dec 12, 2015
@sergeyklay sergeyklay reopened this Dec 12, 2015
andresgutierrez added a commit that referenced this pull request Dec 12, 2015
Fix total_items and total_pages in Paginator when it has `GROUP BY` #2411
@andresgutierrez andresgutierrez merged commit fc8ece5 into phalcon:2.0.x Dec 12, 2015
@andresgutierrez
Copy link
Contributor

Thanks

@pedoc
Copy link

pedoc commented Jul 14, 2016

@andresgutierrez
hi,i was use version 2.0.10,but except 'group',i had 'distinct(true) ' is wrong。sorry,my english is bad.
code example:
$builder=$this->modelsManager->createBuilder()->from("Robots")->leftJoin('Parts',"Parts.id=Robots.part_id")->distinct(true);
$paginator = new Phalcon\Paginator\Adapter\QueryBuilder(
array(
"builder" => $builder,
"limit" => 10,
"page" => 1
)
);
You can get to the two data,but,‘total_items’ property is 3。
I think the problem is the same ‘group’ and the,It is a bug?
Looking forward to your reply。

@Jurigag
Copy link
Contributor

Jurigag commented Jul 14, 2016

As i see query builder paginator ignores distinct method at all. There is only check for groupBy but not for distinct. https://github.com/phalcon/cphalcon/blob/master/phalcon/paginator/adapter/querybuilder.zep

@ryomo ryomo deleted the issue-2411 branch July 18, 2016 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants