-
Notifications
You must be signed in to change notification settings - Fork 824
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
Add ORM abstraction for "WITH" clauses #10902
Comments
This was referenced Sep 12, 2023
This was referenced Sep 21, 2023
This was referenced Sep 25, 2023
GuySartorelli
assigned emteknetnz and GuySartorelli and unassigned GuySartorelli and emteknetnz
Sep 28, 2023
Linked PRs have been merged |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
MySQL 8 supports
WITH
andWITH RECURSIVE
statements, which opens up a whole load of opportunities.The following methods could benefit from recursive queries (though some would have to be behind opt-in config flags for BC):
SiteTree::get_by_link()
SiteTree::relativeLink()
SiteTree::isOrphaned()
SiteTree::InSection()
SiteTree::getBreadcrumbItems()
SiteTree::NestedTitle()
SiteTree::Level()
SiteTree::getPageLevel()
SiteTree::getMenu()
Hierarchy::getAncestors()
Note that the above list was made after a very quick look at
SiteTree
and is far from exhaustive. I haven't looked pretty much anywhere else in core code.Any usage of
WITH
clauses in core code will either need to be behind a condition checking if the current db driver supports it, or we'll have to explicitly say MySQL5.7 is no longer supported (it does go EOL in October 2023). But regardless of usage of the functionality, we can still provide an API for it, and anyone with an up-to-date db server can use it for their own purposes.I've started a POC implementation here: GuySartorelli/silverstripe-framework@5...pulls/5/recursive-orm-queries
Acceptance criteria
SQLSelect
and surfaced inDataQuery
.Note
We're not sure if there's a sensible way to directly use the WITH clause from DataList directly. We'll discover this in the process of implementing this card and potentially spin up a follow up card if needed.DataList
does not need its own abstraction layer at this stage. It can be added as a follow-up in the future if the need arises and a sensible implementation is identified.WITH
clauses) #10962 has been created as a follow-up for this.PRs
The text was updated successfully, but these errors were encountered: