2.0.0#25
Conversation
There was a problem hiding this comment.
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.
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.
- limit() preserves existing _offset when take() is called after skip() - get() applies stored offset even when no limit is set - find(NULL) returns NULL immediately instead of building bad SQL - first_or_new() uses where_null() for NULL attribute values - _default_timestamp_order_column() checks model accessor before field list - when()/unless() accept DMZ_QueryBuilder return values - Add regression tests for all fixes
- Rewrite advanced-query-building.md: remove non-existent scopes, global scopes, union/CTE examples; document actual subqueries, raw expressions, relationship filters, dynamic conditions, and aggregate helpers - Rewrite casting.md: remove stale AttributeCasting trait instructions; document core \ property usage - Fix eager-loading.md: variadic with() examples, correct find()+with() order - Update index.md, query-builder.md, fields.md, upgrading.md, mass-assignment.md: remove trait references, add first-or helpers - Update quick-reference.md: add find/first helpers, ordering aliases, aggregate helpers; fix admonition placement
- Add CI workflow with PHP 8.1-8.5 test matrix - Add docs-deploy workflow (VitePress build + rsync over SSH) - Add check-docs-deploy and deploy-docs composite actions - Default SSH port set to 2200 - Branch targets: master and 2.0.0-beta1
- Harden _unserialize() with allowed_classes => FALSE to prevent object injection - Add trigger_error() deprecation notice to join_related() - Remove @ error suppression on querybuilder include - Remove camelCase aliases (applyOperations, toArray) from LazyCollection
- Document security hardening, deprecation of join_related, removal of camelCase aliases - Add CI/CD workflows to docs changelog - Mark join_related as deprecated in reserved-names reference
- Add documentation for dirty tracking, model events, query scopes, serialization control, and model utilities - Update VitePress sidebar/nav config with new pages - Add cross-references to existing docs (save, delete, refresh, etc.) - Expand quick-reference cheatsheet with new feature sections - Add DataMapper2FeaturesTest with 52 tests covering all new features - Guard field_data() in constructor against missing tables - Remove all Eloquent branding from comments, docs, and tests
No description provided.