Skip to content

Conversation

@g3c0d3r5
Copy link
Contributor

@g3c0d3r5 g3c0d3r5 commented Feb 5, 2023

This pull request fix the issue that when we create a DataTable service from php artisan datatables:make command, the service cannot support CollectionDatatable because applyScopes method in Yajra\DataTables\Services\DataTable class only support EloquentBuilder|QueryBuilder|EloquentRelation.

This pull request fix the issue that when we create a DataTable service from `php artisan datatables:make` command, the service cannot support CollectionDatatable because applyScopes method in Yajra\DataTables\Services\DataTable class only support EloquentBuilder|QueryBuilder|EloquentRelation.
…ble-with-collection-problem

fix applyScopes method to support Collection
@yajra yajra self-requested a review February 6, 2023 03:21
Copy link
Owner

@yajra yajra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good but the static analysis is failing. Can you please make it pass? Thanks!

@yajra yajra changed the title fix applyScopes method to support Collection fix: applyScopes method to support Collection Feb 7, 2023
@yajra
Copy link
Owner

yajra commented Feb 7, 2023

@g3c0d3r5 the latest patch still fails. Thanks!

@yajra yajra changed the base branch from master to 9.0 February 7, 2023 09:50
@g3c0d3r5
Copy link
Contributor Author

g3c0d3r5 commented Feb 7, 2023

Oops, sorry for the missing backslash...

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@yajra yajra merged commit 7985b77 into yajra:9.0 Feb 20, 2023
@yajra
Copy link
Owner

yajra commented Feb 20, 2023

Released on v9.1.4 🚀 Thanks!

@dinhquochan
Copy link

Hello @yajra,

This is a breaking change. Many clients will be 500 errors caused by this PR. Why you accepted a change to the signature in 1 minor version? 🥹

@dinhquochan
Copy link

It should be merged in version 10.x

@dinhquochan
Copy link

😱
image

@yajra
Copy link
Owner

yajra commented Feb 20, 2023

Oh no, the tests are passing. I will check again and revert if needed. It was already merged in 10.x too.

@dinhquochan
Copy link

I've updated it by myself 🥲 @yajra do not revert 🥶

@yajra
Copy link
Owner

yajra commented Feb 20, 2023

Can you provide some snippets to reproduce your issue? Might also cause issue on others.

@yajra
Copy link
Owner

yajra commented Feb 20, 2023

Oh, I think you are extending to your own service class. An isolated case I guess.

@dinhquochan
Copy link

@yajra I just extended DataTable::class and overridden applyScope() method. Because the return type change, the child class should be an error.

@yajra
Copy link
Owner

yajra commented Feb 20, 2023

That makes sense, sorry for the trouble. But it's a needed fix.

@yajra
Copy link
Owner

yajra commented Feb 20, 2023

@dinhquochan sorry in advance again and heads up. On v10 I will update the stub again to allow AnonymousResourceCollection. See #170

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.

3 participants