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

Date column name is unqualified by default #30

Open
Synchro opened this issue Apr 7, 2022 · 0 comments
Open

Date column name is unqualified by default #30

Synchro opened this issue Apr 7, 2022 · 0 comments

Comments

@Synchro
Copy link

Synchro commented Apr 7, 2022

This is mostly a docs issue, but it might be nice to have an automated way of handling it. If you have a set of resources generated from some custom query in Nova, it's possible that the date column that this plugin uses might be ambiguous because it is not qualified with the table name. For example if you add the filter like this:

new DateRangeFilter('Updated', Model::UPDATED_AT),

and you have more than one table with an updated_at field in the selection, you'll get an integrity constraint exception. The workaround is simple: prefix the column name with a table qualifier when you add the filter:

new DateRangeFilter('Updated', 'posts.' . Model::UPDATED_AT),

I've not yet figured out a way to get hold of this table name automatically because we are in a static situation, but the table name for a model is dynamic, and we can't do something like self::$model->table to get hold of it.

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

No branches or pull requests

1 participant