-
Notifications
You must be signed in to change notification settings - Fork 23
2.0.0 #25
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
base: master
Are you sure you want to change the base?
2.0.0 #25
Conversation
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.
There seems to be a mix of camel case and snake case property and method names. E.g. in the HasTimestamps trait, but in other places too.
Personally I only have a couple of legacy CI3 projects left now that use Datamapper, so I probably won't be updating them to support the new features (I'm careful not to blindly use from_array() for example) but if I do get an opportunity, I'll see if any of the changes break one of my existing sites.
|
@jamieburchell The 2.0.0 update is meant to bring the DataMapper more in-line with more modern ORMs (e.g. Eloquent). Getting DataMapper updated to support new features found in modern ORMs is therefor quite beneficial for us, and maybe a few others as well. I've ran some tests with the new datamapper on our project and we've found it's a drop-in replacement for the older 1.8.3.3 version. Allowing us to these modern features found elsewhere without having to rewrite our whole project... yet. I'll fix the issues you've mentioned. and thanks for taking the time to do some tests on your end :) |
|
Wondering if the trait filenames should be snake-case too, or is that intentional due to how composer is loading them? There's more camel case method and property names in Aside - can you help me understand |
|
@jamieburchell
Trait filenames should be good as-is, composer currently has no issue autoloading them. |
|
Giving this a spin now in an existing project. Just realised my lib file is I remember having to go through an exercise between CI2 and 3 to make controller/model/library file case consistent. Wondering if this should be changed here too? |
|
@jamieburchell I'm noticing the same on my end now funnily enough. |
|
In Linux, I have to rename it to
|
|
CI3 comes with an |
|
@jamieburchell |
|
I gave it a quick test in an existing CI3 DM project and no smoke came out of anywhere :) If my understanding of the code changes is correct, it seems that there shouldn't be any BC changes and this is an opt-in type setup. Your new examples and use of method chaining and using Still uses method chaining, instantiates the related manager and departments, only one query, and iterators are used. I guess the smaller focuses queries are quicker 🤷 |
jamieburchell
left a comment
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.
There was me thinking this project was on life-support - and you go and pull this out of the bag. Good job. I can see a lot of thought and work has gone in to this.
My testing has just been on current usage and not using any of the new methods/layers and as far as I can tell there are no backwards incompatible/breaking changes from the quick tests I have done
|
@P2GR I think there are lots of extra lang files in |
…pdate DataMapper to log when missing; rely on delete_pattern()/get_stats() across all drivers.
- Remove get_smart() from DMZ_QueryBuilder (unused sugar) - Remove pluck_collection() from DMZ_QueryBuilder, DMZ_Collection, and DataMapper - Remove pluck_values() from DMZ_QueryBuilder, DMZ_Collection, and DataMapper - Change DMZ_QueryBuilder::get() to return model instead of DMZ_Collection - Users wanting a collection should call collect() explicitly - Update first() and get_array() to work with model return type - Remove related test cases for deleted methods API cleanup: reduces surface area and eliminates user confusion about get() returning collections vs models.
- Document removal of get_smart(), pluck_collection(), pluck_values() - Document QueryBuilder::get() now returns model instead of collection - Update collections.md Query Builder Helpers section - Update quick-reference.md examples
- Add shared dmz_camel_to_snake() helper function - Update DMZ_QueryBuilder and DMZ_Collection to use shared helper - Update DataMapper._camel_to_snake() to delegate to shared helper - Remove deprecated with_deleted(), only_deleted(), without_deleted() aliases - Remove deprecated _dm_with_deleted and _dm_only_deleted properties - Remove legacy property checks from querybuilder.php soft-delete scope - Fix FIXME comment in get() method (silent behavior is intentional) - Update all extension headers to version 2.0.0 - Fix dead overzealous.com links to github.com/P2GR/datamapper2 - Fix typo in rowindex.php header (worIndex -> rowindex) - Update CHANGELOG with all changes
- Add debug() to DataMapper and DMZ_QueryBuilder
- Returns: model, table, SQL, result count, execution time
- Pass FALSE to pretty-print output with syntax highlighting
- Add benchmark() to DataMapper and DMZ_QueryBuilder
- Returns: total queries, total/avg time, memory usage, per-query breakdown
- Optional since_query_index param to measure specific operations
- Color-coded output: green (<10ms), yellow (<100ms), red (>100ms)
- Add get_query_index() helper to mark benchmark starting points
Usage:
\ = \->get_query_index();
\->with('posts')->where('active', 1)->get();
\->benchmark(FALSE, \); // Pretty-print benchmark
\ = \->debug(); // Get debug info as array
- New docs/guide/datamapper-2/debugging.md - Covers debug(), benchmark(), get_query_index(), to_sql() - Add to sidebar and top nav in VitePress config
Users attempting nested eager loading inside a constraint callback now get
a clear error explaining to use dot notation instead:
->with('parent.child') instead of ->with('parent', fn(\) => \->with('child'))
- Update quick-reference.md with new debugging methods - Add Debugging card to DataMapper 2.0 feature grid - Add Debugging row to comparison table
Add explicit constructor to ensure property initialization works consistently across PHP 8.1-8.5 versions in CI.
No description provided.