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

SqlDataProvider and totalCount without pagination #20178

Closed
dfuse-dev opened this issue Jun 1, 2024 · 2 comments
Closed

SqlDataProvider and totalCount without pagination #20178

dfuse-dev opened this issue Jun 1, 2024 · 2 comments
Milestone

Comments

@dfuse-dev
Copy link

What steps will reproduce the problem?

Seems that 'totalCount' is needed now even if no pageSize is configured.

$dataProvider = new SqlDataProvider([
      'sql' => $query,
      'params' => $boundParams,
      'pagination' => [
        'pageSize' => 0,
      ],
    ]);

What is the expected result?

That worked before to get all records

What do you get instead?

now it throws error "Call to a member function getQueryBuilder() on string"
in /var/www/t3/vendor/yiisoft/yii2/db/Query.php (157)

but if i set totalCount

$dataProvider = new SqlDataProvider([
      'sql' => $query,
      'params' => $boundParams,
      'totalCount' => 0,
      'pagination' => [
        'pageSize' => 0,
      ],
    ]);

it works again

Additional info

Q A
Yii version 2.0.50
PHP version 8.2.18
Operating system Debian 12
@bizley
Copy link
Member

bizley commented Jun 2, 2024

Does #20176 help?

@samdark samdark added this to the 2.0.50.1 milestone Jun 3, 2024
@dfuse-dev
Copy link
Author

not really, my attempt has also the $query before pagination and throws the error. Maybe this is only related to SqlDataProvider

@samdark samdark closed this as completed Jun 8, 2024
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

No branches or pull requests

3 participants