Repository navigation
Quick builder fixup - #179
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
mringler
force-pushed
the
quick-builder-fixup
branch
from
November 12, 2026 08:29
7cb33f6 to
724f442
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
QuickBuilder is used extensively during tests (and only there), but its methods does not reflect the current use case. I think this class was written for Propel1 and then with the introduction of the cli moved over into test-only usage.
Take for example the static
buildSchemamethod:buildSchemainsufficiently expresses that this will create DB tables and PHP classes (and not just one of those or even just schema parse result)Changes
buildDatabaseAndClasses(),buildClasses()now take platform and config, covering almost all use casesImplementation Details
Turns out the QuickBuilder is frequently used during vendor-specific tests, however, unless properly configured, it builds for Sqlite. This isn't necessarily a bug, as there are tests that depend on a database connection and basic model hydration or such, but test vendor-independent functionality (like hooks injected by behaviors).
Previously, those tests couldn't be run as agnostic tests, since the available Sqlite connection was not registered. I assume the initial idea was that all db-dependent code should have to pass on all vendor dbs. However, as a result, those Sqlite tests ended up as vendor-specific tests. I find this very misleading - you think it tests on all databases, but the (i.e.) Postgres test is actually a Sqlite test too.
This is now changed, the agnostic tests can use the Sqlite connection. Let's see how that goes.
What is very confusing, the QuickBuilder sometimes uses a provided connection or, in lieu of that, a temporary Sqlite connection, and sometimes the connection associated with the database name as read from schema. Now the database name is consistently tried before falling back to the instant sqlite connection. But this is ultimately a step to the side.
Overall the "what am I building for" problem is a larger one, for another time. The main goal for now is to make QuickBuilder easier to use and a bit more opaque.
Test strategy
Tests itself.
Notes
There is more that could be done later.
I find it particularly confusing that there are three vendor specific type of classes (the adapter for runtime SQL generation, the platform for generator setup, and the parser to read the current schema from db), all three are used in the QuickBuilder, but since there is no way to set them together, it is often unclear which one is actually used.
When using a specific connection, the vendor-classes should be implied (and fixed).