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

[3.2.x] Paginator QueryBuilder with HAVING doesn't support multiple db services #12957

Closed
dnapierata opened this Issue Jul 12, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@dnapierata
Contributor

dnapierata commented Jul 12, 2017

Expected and Actual Behavior

When using the paginator querybuilder with a HAVING and with a model which uses a different db connection service. The paginator incorrectly assumes that the db service is 'db' when performing a count of the total records. https://github.com/phalcon/cphalcon/blob/3.2.x/phalcon/paginator/adapter/querybuilder.zep#L227

I expect that it would use the connection service of the model that the query was built for.
Example:

let modelClass = builder->_models;
if typeof modelClass == "array" {
    let modelClass = array_values(modelClass)[0];
}
let model = new {modelClass}();
let dbService = model->getReadConnectionService();
let db = totalBuilder->getDI()->get(dbService);

Details

  • Phalcon version: (3.2.1)
  • PHP Version: (7.0.18)
  • Operating System: Ubuntu
  • Installation type: Installing via package manager
  • Server: Apache
@Jurigag

This comment has been minimized.

Show comment
Hide comment
@Jurigag

Jurigag Jul 12, 2017

Member

Good point, can you do PR with this code to 3.2.x branch?

Member

Jurigag commented Jul 12, 2017

Good point, can you do PR with this code to 3.2.x branch?

@sergeyklay

This comment has been minimized.

Show comment
Hide comment
@sergeyklay

sergeyklay Jul 17, 2017

Member

@dnapierata
I'm hope this fixed in the #12960 PR. Could you please create a small test which will cover code you have changed? Thank you for contributing.

Member

sergeyklay commented Jul 17, 2017

@dnapierata
I'm hope this fixed in the #12960 PR. Could you please create a small test which will cover code you have changed? Thank you for contributing.

@dnapierata dnapierata referenced this issue Jul 18, 2017

Merged

Added a test for issue 12957 #12970

3 of 3 tasks complete

@sergeyklay sergeyklay closed this Jul 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment