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
5.x query abstract #16675
5.x query abstract #16675
Conversation
1eaacca
to
f9c9693
Compare
public function newQuery(): Query | ||
{ | ||
return new Query($this); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder how big if a break this will be. There's nothing we could transform calls to newQuery() into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could backport the newSelectQuery()
methods to 4.x and add a deprecation to newQuery()
. That would let us encourage users upgrade in a reasonable timeframe.
I'm happy to take care of that when this merges.
src/Database/IdentifierQuoter.php
Outdated
} else { | ||
$this->_quoteParts($query); | ||
} elseif ($query instanceof DeleteQuery) { | ||
$this->_quoteDelete($query); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this have an else throw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess we could for completeness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could get fancy and use match
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, can use match()
, still haven't got accustomed to the fact that it can use expressions for matching :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
* @return void | ||
*/ | ||
protected function _quoteParts(Query $query): void | ||
protected function _quoteParts(Query $query, array $parts): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the parts list separate from the Query instance doesn't feel right. When would we describe a query different than itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just the part/clause names which need to be processed. They are different depending on the query type. The actual values for these parts are fetched from the Query itself.
vendor/bin/phpunit tests/TestCase/Database --verbose --coverage-clover=coverage.xml | ||
CAKE_TEST_AUTOQUOTE=1 vendor/bin/phpunit tests/TestCase/Database --verbose --testsuite=database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to revert this change before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet, I will revert it when I getting to updating the ORM once the changes to database package are done.
src/Database/IdentifierQuoter.php
Outdated
} else { | ||
$this->_quoteParts($query); | ||
} elseif ($query instanceof DeleteQuery) { | ||
$this->_quoteDelete($query); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could get fancy and use match
.
Anymore feedback on this? |
Datbase\Query
abstractRefs #16648