Commit Graph

23826 Commits

Author SHA1 Message Date
Guy Sartorelli
642321db61
FIX Trigger eagerloading for first() and last() (#10875) 2023-07-20 16:37:03 +12:00
Steve Boyd
7daa3fdb08 FIX Short-array syntax for Enum 2023-07-20 16:06:01 +12:00
Guy Sartorelli
60d65dd369
Merge pull request #10871 from creative-commoners/pulls/5/merge-up
MNT Add merge-up action
2023-07-19 17:39:22 +12:00
Steve Boyd
10fba6e787
Merge pull request #10862 from creative-commoners/pulls/5/eagerloading-new-tests
Fix various eagerloading bugs
2023-07-17 13:15:42 +12:00
Guy Sartorelli
ed4c34b9d9
MNT Re-implement static test data for main eagerloading test 2023-07-17 12:03:11 +12:00
Guy Sartorelli
3bf845a9e6
FIX Protect against loading incorrect eager-loaded relations.
Don't fetch eager-loaded has_many or many_many unless we've validated
that the relation IS actually a has_many or many_many relation.
Also clear eager-loaded relations when flushing the record.
2023-07-17 12:03:11 +12:00
Guy Sartorelli
acad946b74
MNT Add missing tests for eagerloaded DataList interactions
Add tests for:
- filtered, limited, and sorted DataLists with eagerloaded relations
- iterating through the list multiple times
- eagerLoad method can be called anywhere in a query chain
- eager loaded relation lists can be correctly empty without throwing
  exceptions
- repeating relations to be eagerloaded in various permutations doesn't
  cause issues
- eagerloading doesn't negatively impact chunkedFetch functionality

squash
2023-07-17 12:03:11 +12:00
Guy Sartorelli
95d1c674a2
FIX Allow multiple iterations of eager-loaded DataLists
Includes making sure toArray() uses the correct iteration logic,
and cloning resets the eagerloaded data for the new clone.

Previously, a second iteration would add every relation item to the
relation list a second time - so with each iteration your relation list
count doubled (though it was the same records time and again).
2023-07-17 12:03:11 +12:00
Guy Sartorelli
d0ca9cfdde
FIX many_many extraFields and join records weren't in eagerloading 2023-07-17 12:03:11 +12:00
Guy Sartorelli
9bed2a3d98
MNT Refactor eagerloading tests into their own class 2023-07-17 12:03:09 +12:00
Steve Boyd
771844335b Merge branch '5.0' into 5 2023-07-17 11:52:07 +12:00
Steve Boyd
3f1b19f688 MNT Add merge-up action 2023-07-12 16:06:20 +12:00
Guy Sartorelli
9b2aee10dc
Merge pull request #10868 from creative-commoners/pulls/5.0/unit-test
MNT Fix unit test
2023-07-12 11:56:09 +12:00
Steve Boyd
3aa6d590a1 MNT Fix unit test 2023-07-11 10:25:16 +12:00
Steve Boyd
ba1082c3bd Merge branch '5.0' into 5 2023-07-10 17:14:15 +12:00
Steve Boyd
b88e7feeeb Merge branch '4' into 5.0 2023-07-10 17:13:59 +12:00
Steve Boyd
193a12ac01 Merge branch '4.13' into 4 2023-07-10 17:13:19 +12:00
Guy Sartorelli
82e96068d2
Merge branch '5.0' into 5 2023-07-10 14:30:07 +12:00
Guy Sartorelli
5854ce6190
Merge branch '4.13' into 5.0 2023-07-10 14:29:03 +12:00
Dylan Wagstaff
8c3ba81052
FIX PHP 8.1 support in MySQLiConnector::query errors (#10570)
* FIX PHP 8.1 support in MySQLiConnector::query errors

The default error reporting mode in PHP 8.1 has changed from using
errors reported on the connection handle to throwing
mysqli_sql_exception. query() makes no allowance for this, and
functions up the call stack expect to catch
Silverstripe\ORM\Connect\DatabaseException instead - resulting in the
MySQLi exception going all the way up to halt the system.

We can use a try, catch, and finally to retain backwards compatibility,
no matter which setting (e.g. PHP version default) someone has enabled.

* Move MySQLConnector test skip call into setUp()

As review feedback; marking the test as skipped in a private function
obfuscated where the call was happening and made it harder to skimread
the tests. Moving this into a setUp function makes it obvious the check
is run before each test case, and skipped if necessary.
2023-07-07 15:56:31 +12:00
Guy Sartorelli
62bd560d0e
Merge pull request #10819 from andrewandante/FEAT_add_only_individual_users_inherited_permission
NEW add OnlyTheseMembers Inherited Permission type
2023-07-07 09:37:59 +12:00
Andrew Paxley
a03d0fdf68 FIX ListboxField entwine submissions 2023-07-06 17:51:16 +12:00
Steve Boyd
730a03d3f6
Merge pull request #10855 from creative-commoners/pulls/5/fix-eagerloading-performance
FIX Resolve problems with eagerloading performance
2023-07-06 17:04:02 +12:00
Guy Sartorelli
7af0fe245c
FIX Resolve problems with eagerloading performance 2023-07-06 14:33:01 +12:00
Sabina Talipova
a57adfc778
MNT Deprecation notice if param has wrong type (#10853) 2023-07-05 17:21:30 +12:00
Guy Sartorelli
612f7e734f
FIX Allow repeated iterations of predicated query result (#10857) 2023-07-05 16:25:58 +12:00
Andrew Paxley
4b22ab4dfe API deprecate InheritedPermissions::getJoinTable 2023-07-05 16:22:17 +12:00
Andrew Paxley
34019426dd NEW add OnlyTheseMembers Inherited Permission type 2023-07-05 16:22:17 +12:00
Guy Sartorelli
85e503d012
ENH Refactor eagerloading fetch into separate methods
It is hard to work with the current structure - having each relation
type in its own method makes it way easier to see where my concerns
start and end with a given relation.

This also reduces the chance of variable bleed-over, where the value in
a variable in the first loop (in the same or other relation type) could
bleed into the next iteration of the loop.
2023-07-05 12:48:58 +12:00
Guy Sartorelli
66f2df2571
Merge pull request #10842 from andrewandante/ENH_add_listboxfield_react_component_schema
NEW ListboxField react field schema
2023-07-05 10:17:54 +12:00
Thomas Portelange
6fa71bbf51
ENH avoid multiple calls to records->count() In PermissionCheckboxSetField (#10839)
these calls are not cached and lead to duplicate queries

Co-authored-by: Michal Kleiner <mk@011.nz>
2023-07-04 13:34:12 +12:00
Andrew Paxley
e1d10a0b4c NEW ListboxField react field schema 2023-07-04 11:28:01 +12:00
Maxime Rainville
110c9135e0
MNT Tweak the Eagerload test to not worry about sort order (#10848)
* MNT Tweak the Eagerload test to not worry about sort order
* MNT Use array keys for EagerLoad test DataProvider
2023-07-03 16:32:03 +12:00
Thomas Portelange
a019b34fac
csfix 2023-06-28 10:56:22 +02:00
Thomas Portelange
a969180433
add anonymize 2023-06-28 10:25:19 +02:00
Guy Sartorelli
60ca35c02d
Merge pull request #10841 from creative-commoners/pulls/5/optimise-get-schema
ENH Cache DataObject::getSchema()
2023-06-28 15:08:53 +12:00
Guy Sartorelli
87d82ee0ce
Merge pull request #10840 from creative-commoners/pulls/5/eager-optimise
ENH Cache $item->ID for eager loading
2023-06-28 15:07:49 +12:00
Steve Boyd
46d7930489 ENH Cache DataObject::getSchema() 2023-06-28 11:11:43 +12:00
Steve Boyd
ed07303703 ENH Cache $item->ID for eager loading 2023-06-27 19:46:29 +12:00
Sabina Talipova
bb5378e177
FIX Gridfiled pagination missing after search (#10828) 2023-06-26 12:11:33 +12:00
Thomas Portelange
9391e696bb
use Member::class 2023-06-23 09:35:34 +02:00
Thomas Portelange
2e73b5eeca
Use cached query
Fixes https://github.com/silverstripe/silverstripe-framework/issues/10833
2023-06-22 11:04:26 +02:00
Guy Sartorelli
0c40cc9b3d
Merge branch '5.0' into 5 2023-06-22 11:19:59 +12:00
Guy Sartorelli
fb7d2256f1
Merge branch '4.13' into 5.0 2023-06-22 11:18:46 +12:00
Guy Sartorelli
ab4802caaf
Merge pull request #10829 from creative-commoners/pulls/4.13/fix-last-page
FIX LastPage method returns true if TotalPages equals 0
2023-06-22 11:16:57 +12:00
Sabina Talipova
ad9df97626 FIX LastPage method returns true if TotalPages equals 0 2023-06-22 10:50:41 +12:00
Guy Sartorelli
6bf32c9e20
Merge pull request #10827 from creative-commoners/pulls/5/doc-eagerload
DOC Update eagerLoad() docblock
2023-06-21 16:44:16 +12:00
Steve Boyd
e9358c88af DOC Update eagerLoad() docblock 2023-06-21 14:12:55 +12:00
Steve Boyd
11e573694d Merge branch '5.0' into 5 2023-06-19 17:33:35 +12:00
Sabina Talipova
220fee6a44
Merge pull request #10823 from creative-commoners/pulls/5.0/duplicate
MNT Remove duplicate translation keys
2023-06-19 17:10:05 +12:00