Commit Graph

289 Commits

Author SHA1 Message Date
Maxime Rainville
fd8b0cc253 MNT Fix broken test caused by missing table 2021-10-04 15:16:10 +13:00
Michal Kleiner
38fe326262 MNT Fix minor typos 2021-09-25 00:23:43 +12:00
Michal Kleiner
7226d7fab6 ENH Add tests for Hierarchy extension when applied to a subclass 2021-09-25 00:23:43 +12:00
Matt Peel
f99ba5d716 NEW Add extension point to DataObject->hydrate() 2021-08-25 16:07:02 +12:00
Steve Boyd
87d076faa6 FIX Cast DBInt value to int 2021-07-06 16:43:54 +12:00
Steve Boyd
8e803bbcfc FIX Parse Enums with dots in their values 2021-07-01 16:00:08 +12:00
Michal Kleiner
0bd5b98d62 MNT Fix typos in test comments 2021-06-03 13:49:24 +12:00
Michal Kleiner
9dd69c40e3 NEW Add DBText->Summary tests 2021-06-03 13:49:24 +12:00
Steve Boyd
9ccdb8efb2 Merge branch '4.7' into 4.8 2021-05-31 17:04:54 +12:00
Maxime Rainville
472fc4ebb4
BUG Update DataQuery::exists to return false when limit causes no result to be returned (#9946)
* BUG Update DataQuery::exists to return false when limit causes no result to be returned

* Update comment

* Fixing linting issue
2021-05-31 16:50:58 +12:00
Maxime Rainville
6fc25e4e96
RFC Add chunk method to DataList to iterate over large dataset (#8940) 2021-04-14 07:49:44 +12:00
Maxime Rainville
9ca33950a2
API Add a CREATE_MEMORY_HYDRATED option to DataObject constructor (#9767) 2021-01-21 14:07:06 +13:00
William Desportes
c932d7e7fb
Fix the phpdoc blocks 2020-12-21 22:23:23 +01:00
Steve Boyd
5be045f9a2 FIX Bug when specifying 0 in ArrayList::offsetSet 2020-12-15 14:50:10 +13:00
Steve Boyd
6e77d5eada NEW DataObject related objects service 2020-10-29 09:29:26 +13:00
Sam Minnee
9247bc8b79 NEW: Add Symfony 4 support alongside Symfony 3
- Remove duplicate key in YML file
 - Remove deprecated yaml dump indentation set (the constructor arg works in both ^3 and ^4)

Fixes #9274
2020-09-21 19:09:08 +12:00
Dan Hensby
ae0ece2b02
Merge pull request #9665 from creative-commoners/pulls/4/php8-fqcn-token 2020-09-18 20:44:22 +01:00
Sam Minnee
0d7c5a9ece NEW Add/remove callbacks on RelationList
This provides a mechanism for adjusting the behaviour of these
relations when building more complex data models.

For example the following example has a status field incorporates a
Status field into the relationship:

```php
function MyRelation() {
  $rel = $this->getManyManyComponents(‘MyRelation’);
  $rel = $rel->filter(‘Status’, ‘Active’);

  $rel->addCallbacks()->add(function ($relation, $item, $extra) {
    $item->Status = ‘Active’;
    $item->write();
  });
}
```

Introduces a new library dependency: http://github.com/sminnee/callbacklist
2020-09-18 13:33:42 +12:00
Garion Herman
099ee2deb7 FIX Remove extraneous @depends annotations 2020-09-15 17:40:42 +12:00
Garion Herman
f1c94e6d54 FIX Allow quotes in expected ReflectionExceptions within tests 2020-09-15 17:40:42 +12:00
Robbie Averill
de61681dec
Merge pull request #9634 from open-sausages/pulls/4/ellipsis
BUG Use proper ellipsis character in the various summary method.
2020-09-10 14:48:33 -07:00
Maxime Rainville
acdebcdba7 Fix unit test 2020-09-10 17:08:13 +12:00
Guy Marriott
3575070b9d FIX Removing selected column detail only if having is empty (MySQL "feature") 2020-09-01 16:21:43 +12:00
Serge Latyntcev
f57d5cc807 ENH Test coverage for MySQL connection collation 2020-08-30 13:21:38 +12:00
Sam Minnée
b810b7d5c9
API: Allow for user-created objects to have values passed in the constructor (#8591) 2020-08-20 12:28:31 +12:00
Maxime Rainville
26b8b7964e Rename DefaultEllipsis to defaultEllipsis 2020-08-07 09:48:42 +12:00
Maxime Rainville
896c0e4388 BUG Use proper ellipsis character in the various summary method. 2020-08-06 19:37:03 +12:00
Mojmir Fendek
c2ed6a4cd6 NEW: WithMockTime callback. 2020-08-06 11:18:39 +12:00
Garion Herman
d408a4e714 Merge branch '4.6' into 4 2020-07-13 12:28:14 +12:00
Garion Herman
fbe0f5a981 Merge branch '4.5' into 4.6 2020-07-13 12:27:02 +12:00
Maxime Rainville
b780c4f504 BUG Tweak DBHTMLText::Plain to avoid treating some chinese characters as line breaks. 2020-07-09 13:33:43 +12:00
Sam Minnee
01d3b4fd96 FIX: Set many-many-through joinRecord on newly added records.
When many-many-through relations are queried, a joinRecord is set on
each DataObject in the list to provide the extra fields defined on
the connector object. This didn’t previously happen when the record
was first add()ed to a list. This fixes that bug.
2020-07-02 15:18:12 +12:00
Daniel Hensby
080ce157ce
Fix various typos in comments 2020-05-16 10:34:53 +01:00
Michal Kleiner
21129b1624
Use short array syntax across the framework's codebase 2020-05-16 10:34:45 +01:00
Mojmir Fendek
7dc6b36c16
Unique key for DataObject (#9400)
NEW Unique key for DataObject
2020-05-04 09:10:51 +12:00
Daniel Hensby
237b2d5f74
Convert array delcarations to short array syntax 2020-04-20 18:58:09 +01:00
Ingo Schommer
2c5deceeb4 FIX Filter out all FULLTEXT BOOLEAN chars
The query might still work depending on where these chars are placed,
but it seems weird to only remove *some* of the valid chars here.
See https://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html

Note that the query runs both the actual boolean query with chars,
and then a separate relevance search without them.
2020-04-09 10:32:45 +12:00
Ingo Schommer
c6b698cb02 NEW Allow InnoDB for FULLTEXT indexes
MyISAM used to be the only one to support it, now InnoDB has caught up.
Unless an engine is set specifically in create_table_options,
this will auto-convert existing MyISAM tables to InnoDb.

Fixes #9242
2020-04-09 10:32:45 +12:00
Steve Boyd
9d5c3ef20e Merge branch '4.4' into 4.5 2020-02-11 16:45:15 +13:00
Mojmir Fendek
99786dda22 ORM Column now supports related table lookup 2020-01-28 15:46:30 +13:00
Andre Kiste
6650d81324 BUG Fix extra blank Group being created when creating a new Group (#9325)
* Fix extra blank Group being created when creating a new Group

* Update tests to reflect expected behavior

* Improved tests
2019-11-27 09:32:33 +13:00
Serge Latyntcev
33a28394d6 Merge branch '4.4' into 4 2019-10-18 15:59:28 +13:00
Serge Latyntcev
0cf5d4cbe2 Merge branch '4.3' into 4.4 2019-10-18 15:58:13 +13:00
Serge Latyntcev
46b9530d88 PSR2 linting fixes 2019-10-18 15:31:39 +13:00
Michal Kleiner
bcbf90a837 NEW Introduce supported database transaction mode check 2019-09-16 14:44:15 +12:00
Robbie Averill
aa6b244db9 Merge branch '4.4' into 4 2019-09-13 18:11:46 -07:00
Robbie Averill
592ab6abc1 Merge branch '4.3' into 4.4 2019-09-13 18:11:34 -07:00
Maxime Rainville
591b88a9bc BUG Allow infinite loop when calling DataObject::writeComponent() recursively 2019-09-10 14:15:28 +12:00
Robbie Averill
a5d6b998fc Merge branch '4.4' into 4 2019-08-16 16:40:39 +12:00
Robbie Averill
f354e2018d FIX Set minimum test scores and password length for Members while running fixtured DataObject tests 2019-08-15 15:23:11 +12:00
Robbie Averill
45f86658ca Merge branch '4.4' into 4 2019-08-14 09:31:05 +12:00
Robbie Averill
4b44272367 Merge branch '4.3' into 4.4 2019-08-14 09:30:53 +12:00
Robbie Averill
d63e4b520c Merge branch '4.2' into 4.3 2019-08-14 09:30:41 +12:00
UndefinedOffset
c1ffc4edfb Added unit tests for multiple relationship sorting 2019-07-29 10:45:10 -03:00
Simon Gow
22b514c421 #9114 - DBText::ContextSummary() cuts line breaks
ContextSummary() was cutting the HTML which was added by nl2br because
it expected plain text elements as it's stripping and replacing text.
Instead this fix changes the behaviour to apply the nl2br after the text
changes have been made. That way we can't cut anything in the middle of
a HTML tag, but new lines, or paragraphs are replaced by BRs after,
should they exist.

- Added tests to ensure text is not cut in the middle of a sentence.
- Added test to ensure that <br>'s are added in the correct place should
the summary span between new lines.
2019-07-19 12:43:20 +12:00
Serge Latyntcev
29a663c65d Merge branch '4.4' into 4 2019-07-15 09:24:49 +12:00
Robbie Averill
844d2ef134 NEW DBDate and DBDatetime now support modify() with a strtotime() style adjustment string (#9105) 2019-07-05 15:57:23 +12:00
Sam Minnee
96e7914f23 FIX: Fix MySQLQuery::seek() and Query::rewind() to fix repeated iteration
API: Query::seek() and Query::rewind() no longer return a value.

Although breaking an API inside a patch release may seem odd, this in
fact is correcting a long-standing bug in our implementation of 
Iterator::rewind(), so I think it’s appropriate.

https://github.com/silverstripe/silverstripe-framework/issues/9097
2019-07-03 09:20:05 +12:00
Jarkko Linnanvirta
9184056b5e URLSegmentFilter: Remove : characters from url segments when multibyte characters are allowed. 2019-06-02 11:43:51 +03:00
Robbie Averill
00fd74a0a1 Merge branch '4.4' into 4
# Conflicts:
 #	src/Dev/Tasks/MigrateFileTask.php
2019-05-30 09:36:42 +12:00
Robbie Averill
14673ffd0a Merge branch '4.3' into 4.4 2019-05-30 09:35:26 +12:00
Robbie Averill
188698dcee Merge branch '4.2' into 4.3 2019-05-30 09:35:17 +12:00
Robbie Averill
3e2fc6aa0b Automated phpcbf linting 2019-05-30 09:34:34 +12:00
Guy Marriott
350888bf50 NEW Adding a shuffle method to ArrayList (#8984)
* NEW Adding a shuffle method to ArrayList

* API Add shuffle to DataList for ArrayList parity
2019-05-16 09:26:11 +12:00
Aaron Carlino
3f1479edbb
BUGFIX: DataQuery overwriting _SortColumn selects (#8974)
* BUGFIX: DataQuery overwriting _SortColumn selects

* FIX DataQuery _SortColumn handling
2019-05-15 11:42:10 +12:00
Maxime Rainville
8ee50d2ba7 API Remove DataObjectSchema::getFieldMap() (#8960)
Introduced as a less public API in https://github.com/silverstripe/silverstripe-assets/pull/227
2019-05-06 12:33:23 +12:00
Guy Marriott
82c8225502
Merge branch '4.3' into 4.4 2019-05-03 09:45:25 +12:00
Serge Latyntcev
3d777cfb8a Backward compatible behaviour for SQLConditionalExpression::getJoins 2019-05-02 15:39:36 +12:00
Andre Kiste
0c6c57f1ef Add getFieldMap method to retrieve a list of all fields for any giv… (#8892)
* Add `getFieldMap` method to retrieve a list of all fields for any given class

* Add `TagsToShortcodeTask` to upgrading guide

Adding after the file migration part as this is where it makes the most sense to run it.

* `getFieldMap` accepts an array

* Move to `DataObjectSchema`

* Add `HTMLVarchar` to documentation
Minor refactoring

* Add test for checking that `subclassesfor` works without the base class
Add test `DataObjectSchema::getFieldMap` returns the correct array

* Remove cms dependency
2019-04-30 10:43:14 +12:00
Aaron Carlino
c63eecc3e1 Merge branch '4.3' into 4 2019-04-18 11:57:36 +12:00
Guy Marriott
da1af3d8b0
FIX Postgres booleans should return as int for consistency 2019-04-17 15:15:17 +12:00
Guy Marriott
9d6b5048a6 FIX Table aliases are retained on base tables in queries built using SQLConditionalExpression (#8918)
* Adding failing test for base table aliases using SQLSelect

* FIX Retain table aliases applied to the base table on queries

* FIX Move the trimmed alias outside of the condition so we can use it within the condition
2019-04-16 15:40:09 +12:00
Sam Minnee
d295888838 MINOR: Improve type testing 2019-04-05 15:11:21 +13:00
Sam Minnee
2625cea5e3 MINOR: Add a test that 0 is falser on int, decimal, currency
Validates that https://github.com/silverstripe/silverstripe-framework/issues/3473 has been fixed

The bug was fixed in #8448
2019-04-05 15:11:21 +13:00
Sam Minnee
4f4153c834 MINOR: Test test to validate that multiple GreaterThan filters in a filterAny work.
Confirms https://github.com/silverstripe/silverstripe-framework/issues/3995 isn’t a bug.
2019-04-05 15:05:42 +13:00
Johannes Hammersen
e1190e33d2 Fix PDOConnector GeneratedID return type 2019-03-21 09:26:14 +01:00
Damian Mooyman
6b450395ce API Allow empty arraylists to be typed (#8866)
* API Allow empty arraylists to be typed

* PHPCBF fixes
2019-03-20 11:46:35 +13:00
Dan Hensby
765d1568ab
Merge branch '4.3' into 4 2019-03-06 11:04:50 +00:00
Dan Hensby
a8605b04e0
Merge branch '4.2' into 4.3 2019-03-06 11:04:14 +00:00
Damian Mooyman
d1396b7dfe
BUG Fix writeBaseRecord with unique indexes
Fixes #6819
2019-02-27 16:40:12 +13:00
Maxime Rainville
11b9429c34 Merge branch '4.3' into 4 2019-02-27 12:14:51 +13:00
Maxime Rainville
651d537196 Merge branch '4.2' into 4.3 2019-02-27 12:13:24 +13:00
Maxime Rainville
ed013fcfbb Merge branch '4.1' into 4.2 2019-02-27 12:12:39 +13:00
Maxime Rainville
ac53f77115 Merge branch '4.0' into 4.1 2019-02-27 12:11:47 +13:00
Maxime Rainville
6ff319a0e1 BUG Implement peer review feedback, 2019-02-27 11:14:47 +13:00
Maxime Rainville
9a59f2f57d BUG Renable the ability to do dynamic assignment with DBField 2019-02-22 11:08:43 +13:00
Robbie Averill
79e44b42fa Merge branch '4.1' into 4.2 2019-02-19 08:37:07 +07:00
Aaron Carlino
09c539e1c3 Merge branch '4.3' into 4 2019-02-19 12:21:24 +13:00
Maxime Rainville
25bba49923 [SS-2018-021] Fix potential SQL vulnerability in non-scalar value hyrdation 2019-02-19 12:20:24 +13:00
Maxime Rainville
95505db7d6 [SS-2018-021] Fix potential SQL vulnerability in non-scalar value hyrdation 2019-02-12 21:08:09 +13:00
Maxime Rainville
fd90cf6ceb [SS-2018-021] Fix potential SQL vulnerability in non-scalar value hyrdation 2019-02-12 20:44:17 +13:00
Loz Calver
7c5b73881b FIX: Prevent null->null being flagged as a value change (fixes #8774) 2019-02-06 13:24:18 +13:00
Loz Calver
3f8551df41
Merge pull request #8462 from sminnee/nondestructive-enum
FIX: Make all enums non-destructive, not just ClassName
2018-11-28 16:42:12 +01:00
Guy Marriott
b2dd22fb50
Merge pull request #8506 from creative-commoners/pulls/4.3/all-the-unit-tests
NEW Adding a stack more unit tests for logging and some form fields
2018-11-11 10:31:24 +13:00
Sam Minnee
a8d3b95175 FIX: Make test work with utf8mb4 2018-11-10 12:10:25 +13:00
Sam Minnee
bd5a815909 FIX: Make all enums non-destructive, not just ClassName
This change also renders a portion of DBSchemaManager irrelevant, that
destructively “fixes” old values. This is in keeping with the
non-destructive principle of dev/build, and some suggestions to move
away from enum fields altogether.

Fixes https://github.com/silverstripe/silverstripe-framework/issues/1387
2018-11-10 12:10:25 +13:00
Robbie Averill
0f2eebe5d4 NEW Change to variadic calls in ListDecorator and add unit tests 2018-11-09 13:59:14 +02:00
Sam Minnee
5531baa87f FIX: Introduce readonly transaction test to all database.
This should work on MySQL and PDO; let’s test this.
2018-11-09 10:57:26 +13:00
Sam Minnee
2615399535 FIX: Use PDO’s built-in transaction support in MySQLDatabase. 2018-11-09 10:31:19 +13:00
Sam Minnee
0111b98b18 FIX: Ensure that types are preserved fetching from database
This ensures that numeric fields appear in PHP as int/float values
rather than strings, which allows the development of more type-safe PHP
code.

This doesn’t work on the legacy mysql driver and this will now throw
a notice-level error. It requires mysqlnd.
2018-11-09 10:31:19 +13:00