Commit Graph

23219 Commits

Author SHA1 Message Date
Guy Sartorelli
d9be52579d
MNT Fix test 2022-09-15 13:29:29 +12:00
Guy Sartorelli
a76fa32a39
API Remove unnecessary getGenerator() method.
`getIterator()` now returns a generator by default.
2022-09-15 13:29:29 +12:00
Guy Sartorelli
bf331072df
FIX Don't try to call count() on an iterator 2022-09-15 13:29:29 +12:00
Sam Minnee
81beddc161
Add deprecated method to make CMS tests work 2022-09-15 13:29:29 +12:00
Sam Minnee
9eb9e13071
FIX: Re-set finalisedQuery to allow recreation of iterator. 2022-09-15 13:29:29 +12:00
Sam Minnee
9c7ecb1f79
Further work on Loz’ solution 2022-09-15 13:29:29 +12:00
Loz Calver
850482138b
Proposed solution for caching template generator counts 2022-09-15 13:29:29 +12:00
Loz Calver
8e0e797b40
Fix code style 2022-09-15 13:29:27 +12:00
Loz Calver
749405170c
Update MySQLDatabaseTest to work with new query iterators 2022-09-15 13:29:10 +12:00
Sam Minnee
6ef5785fc5
FIX: pre-cache loop content within SSViewer.
SSViewer iterates on Iterators that it receives twice: first to get the
total number of items, then to actually render each item.

This necessitates a rewind. In order to make more use of generators,
which are not rewindable, I’d like to remove the need for a rewind.

I’ve done this by caching the content of the iterator as an array
within SSViewer_Scope.

Although this means a bit of memory usage, there are no cases in which
code will get to this point without iterating on all items, which would
use the memory anyway. It would only create onerous impacts in cases
where you are iterating on very long iterators, which would mean you’re
rendering a very large page anyway, and probably have other performance
issues.
2022-09-15 13:29:00 +12:00
Loz Calver
1b8f601023
NEW: Make DataList::getIterator a generator 2022-09-15 13:29:00 +12:00
Sam Minnee
77c7552c3f
NEW: ORM’ Query is a generator-based IteratorAggregate
API: Query no longer has iterator methods current(), first(), rewind(), next()

Using generators reduces the amount of boilerplate needed for this
code.

Turning it into an IteratorAggregate means that the iterator can be
re-created for each subsequent foreach call. This means that the
rewind() and seek() functionality can be discarded.
2022-09-15 13:28:56 +12:00
Sam Minnee
d8735633a7
FIX: Don’t call PaginatedList::getIterator() directly.
It’s best for foreach() to call this for us.
2022-09-15 13:28:20 +12:00
Sam Minnee
1efe2b46ff
FIX: Fix PaginatedList::toArray()
It wasn’t respecting pagination.
2022-09-15 13:28:20 +12:00
Sam Minnee
6c136c9cf2
NEW: Iterate ArrayList via a generator
Using a generator here means that we don’t need to prepare a duplicate
array in-memory before iterating.
2022-09-15 13:28:20 +12:00
Sam Minnee
2ead3746d6
Replace Map_Iterator with a generator.
Generators (PHP 5.5+) make this kind of code structure much easier to
build.
2022-09-15 13:28:20 +12:00
Guy Sartorelli
03b929dd33
API Remove support for PDO (#10499) 2022-09-15 13:13:48 +12:00
Guy Sartorelli
5da5555ce3
Merge pull request #10506 from creative-commoners/pulls/5/symfony-cache-fix
FIX Pass PSR6 caches to ChainAdapter
2022-09-13 17:28:39 +12:00
Steve Boyd
a2028a2817 FIX Pass PSR6 caches to ChainAdapter 2022-09-13 16:44:07 +12:00
Guy Sartorelli
a605093656
Merge branch '4' into 5 2022-09-09 16:48:20 +12:00
Guy Sartorelli
c4eadcd074
Merge branch '4.11' into 4 2022-09-09 16:47:49 +12:00
Guy Sartorelli
7e9ced0824
Merge pull request #10470 from creative-commoners/pulls/4.11/case-insensitive-casting
FIX Normalise casing before casting fields
2022-09-08 12:45:09 +12:00
Guy Sartorelli
a6a07a7ef2
Merge pull request #10491 from creative-commoners/pulls/5/symfony6-translation-2
API Update translation to use symfony 6
2022-09-08 12:29:43 +12:00
Steve Boyd
a87a657367 API Update translation to use symfony 6 2022-09-08 11:52:34 +12:00
Guy Sartorelli
8fe2a786dc
Merge pull request #10478 from creative-commoners/pulls/5/symfony6-cache
API Update caching to use symfony 6
2022-09-07 16:27:59 +12:00
Steve Boyd
c9bc01473c API Update caching to use symfony 6 2022-09-07 16:08:54 +12:00
Guy Sartorelli
06b13e0fa6
Revert "Merge pull request #10450 from creative-commoners/pulls/5/rescue-master-generators" (#10483)
This reverts commit 9edf3a5ca6, reversing
changes made to 934fafd29d.
2022-09-02 10:58:37 +12:00
Guy Sartorelli
1bf86cf39f
API Revert shorten auto-generated table names (#10482)
* Revert "BUG Fix table name test"

This reverts commit b36a01a8fd.

* Revert "ENH shorten auto-generated table names"

This reverts commit 156f63bce3.
2022-09-02 10:55:45 +12:00
Guy Sartorelli
e6fb9634b5
DEP Revert change to dependency that was made during a merge-up (#10479) 2022-09-01 14:48:18 +12:00
Steve Boyd
37ff4ee46a
Merge pull request #10454 from creative-commoners/pulls/5/rescue-master-table-name
API rescue master-branch PR: Shorten auto-generated table names #7621
2022-09-01 09:12:11 +12:00
Maxime Rainville
9f32b4b284
Merge pull request #10477 from creative-commoners/pulls/5/remove-accidental-deprecation-warnings
FIX Remove accidental deprecation warnings.
2022-08-31 14:02:51 +12:00
Guy Sartorelli
89a0f59ef1
FIX Remove accidental deprecation warnings.
These were erroneously added via a merge-up from 4 to 5.
2022-08-31 13:50:33 +12:00
Guy Sartorelli
f0a20ed400
MNT Fix merge-up error. 2022-08-31 13:38:18 +12:00
Guy Sartorelli
715415d5c8
Merge branch '4' into 5 2022-08-31 13:37:25 +12:00
Steve Boyd
250a75b233
Merge pull request #10457 from creative-commoners/pulls/5/rescue-master-extensions-expose-public
API Rescue Master Branch PR: Only expose public extension methods
2022-08-29 19:09:00 +12:00
Steve Boyd
9edf3a5ca6
Merge pull request #10450 from creative-commoners/pulls/5/rescue-master-generators
API rescue master-branch PR: Use Generators for ORM
2022-08-29 19:03:47 +12:00
Guy Sartorelli
6d885ab894
FIX Normalise casing before casting fields 2022-08-25 17:36:06 +12:00
Steve Boyd
934fafd29d
Merge pull request #10459 from creative-commoners/pulls/5/rescue-master-no-dual-support
ENH Rescue Master Branch Commits: CSV BOM stripping is now handled internally by league/csv
2022-08-25 10:01:50 +12:00
Steve Boyd
f14c60ceb2
Merge pull request #10463 from creative-commoners/pulls/4/rescue-master-static-analysis
Rescue Master Branch PR: ENH Various changes via static analysis tooling
2022-08-25 09:50:13 +12:00
Steve Boyd
feb57dbf1f
Merge pull request #10461 from creative-commoners/pulls/5/rescue-master-abstract-testcase
API Rescue Master Branch PR: TestCase classes should be abstract to prevent warnings
2022-08-24 15:37:18 +12:00
Steve Boyd
9e057d8902
Merge pull request #10458 from creative-commoners/pulls/5/rescue-master-abstract-migrationtask
API Rescue Master Branch PR: Update MigrationTask class to be an abstract class
2022-08-24 15:35:46 +12:00
Steve Boyd
b37921d0b1
Merge pull request #10462 from creative-commoners/pulls/5/rescue-master-join-aliases
Rescue Master Branch PR: Fix SQLConditionalExpression::getJoins so it always adds explicit aliases
2022-08-24 15:33:41 +12:00
Damian Mooyman
f2211d690f
BUG Fix extend() failing on protected extend-prefixed methods 2022-08-24 15:31:43 +12:00
Damian Mooyman
76fc8f1596
API Only expose public extension methods
API Enable `extend*` methods to handle ->extend()
API Remove Extensible::constructExtensions()
2022-08-24 15:31:34 +12:00
Steve Boyd
f5d72e998c
Merge pull request #10460 from creative-commoners/pulls/5/rescue-master-dataobject-get-any-one
API Rescue Master Branch PR: Allow dataobject get_one without passing a class
2022-08-24 15:25:13 +12:00
Steve Boyd
4a3b6d951b
Merge pull request #10456 from creative-commoners/pulls/5/rescue-master-remove-unsafe-queryparams
API Rescue Master Branch PR: Remove isDev / isTest querystring arguments
2022-08-24 15:14:45 +12:00
Viktor Szépe
94d1ac8d99
ENH Various changes via static analysis tooling 2022-08-24 12:14:32 +12:00
Serge Latyntcev
e07671a890
Fix SQLConditionalExpression::getJoins so it always adds explicit aliases
This is a revert of https://github.com/silverstripe/silverstripe-framework/pull/8956
2022-08-24 11:27:02 +12:00
Daniel Hensby
2c102c61a9
API TestCase classes should be abstract to prevent warnings 2022-08-23 17:12:24 +12:00
Andrew Aitken-Fincham
f2de39162d
API Allow dataobject get_one without passing a class
add class validation early in get_one()
2022-08-23 16:25:23 +12:00