Skip to content

Add NetteDatabaseDataSource for raw SQL queries via Nette\Database\Explorer#1253

Open
radimvaculik wants to merge 1 commit intomasterfrom
feature/nette-database-data-source
Open

Add NetteDatabaseDataSource for raw SQL queries via Nette\Database\Explorer#1253
radimvaculik wants to merge 1 commit intomasterfrom
feature/nette-database-data-source

Conversation

@radimvaculik
Copy link
Member

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.

@radimvaculik radimvaculik force-pushed the feature/nette-database-data-source branch from 8da10fe to 4d87bf5 Compare February 22, 2026 13:30
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +95 to +98
call_user_func(
$sorting->getSortCallback(),
$this->sql,
$sorting->getSort()

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

Comment on lines +119 to +121
public function getDataSource(): Explorer
{
return $this->connection;

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@radimvaculik radimvaculik force-pushed the feature/nette-database-data-source branch from 4d87bf5 to a33d2af Compare February 22, 2026 13:39
…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.
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.

1 participant