Add NetteDatabaseDataSource for raw SQL queries via Nette\Database\Explorer#1253
Add NetteDatabaseDataSource for raw SQL queries via Nette\Database\Explorer#1253radimvaculik wants to merge 1 commit intomasterfrom
Conversation
8da10fe to
4d87bf5
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8da10fe4d7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| call_user_func( | ||
| $sorting->getSortCallback(), | ||
| $this->sql, | ||
| $sorting->getSort() |
There was a problem hiding this comment.
Pass mutable query state to sort callback
When a sortable callback is configured, this method returns immediately after invoking it, but it passes $this->sql (a plain string) to call_user_func and ignores any return value. Because the callback cannot mutate the datasource state used by buildFinalSql(), custom sorting has no effect for this datasource and requests using setSortableCallback() end up unsorted.
Useful? React with 👍 / 👎.
| public function getDataSource(): Explorer | ||
| { | ||
| return $this->connection; |
There was a problem hiding this comment.
Expose filterable query object from getDataSource
FilterableDataSource::filter() forwards getDataSource() into every Filter::setCondition() callback, but this implementation returns Explorer, while actual reads are built only from $this->sql plus $whereConditions. Any custom filter callback therefore cannot modify the query that getData()/getCount() execute, so custom filter conditions become ineffective for this datasource.
Useful? React with 👍 / 👎.
4d87bf5 to
a33d2af
Compare
…plorer Ports the contributte/datagrid-nette-database-data-source package into the main datagrid repository. Uses subquery wrapping for filter injection instead of PHPSQLParser, avoiding any extra dependencies.
a33d2af to
94caf07
Compare
Ports the contributte/datagrid-nette-database-data-source package into the main datagrid repository. Uses subquery wrapping for filter injection instead of PHPSQLParser, avoiding any extra dependencies.