Commit Graph

581 Commits

Author SHA1 Message Date
Sergey Shevchenko
04b7ad51b8
Merge branch 'silverstripe:4' into 4 2021-11-01 13:12:59 +13:00
GuySartorelli
059d8aac0a
NEW Add afterUpdateCMSFields method to DataObject. (#9819) 2021-10-26 16:05:11 +13:00
Mo Alsharaf
2c1ef4df23
MNT Update URL in docs for ICU documentation (#10118) 2021-10-15 11:28:16 +13:00
Michal Kleiner
38fe326262 MNT Fix minor typos 2021-09-25 00:23:43 +12:00
Michal Kleiner
1e5414eac7 FIX Use correct ancestor class when querying for stage and live children
The right ancestor class that has the Hierarchy extension applied needs to be used
since it doesn’t have to be the class directly extending from DataObject, which means
the ID and ParentID columns might be in different tables.
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
GuySartorelli
cacd762357
Avoid "new" keyword to instantiate CompositeValidator
The CompositeValidator is Injectable, so we should allow project code to replace it here via the Injector.
2021-08-02 12:46:53 +12:00
GuySartorelli
5699db306d
FIX: Remove limits in removeAll method.
Keeping a limit here results in a DatabaseException "This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'"
2021-07-12 17:14:46 +12:00
Steve Boyd
f6e8d6e591 Merge branch '4.8' into 4 2021-07-07 14:03: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
Steve Boyd
9463aaf571 Merge branch '4.8' into 4 2021-06-08 11:49:01 +12:00
David Peck
28b5b803be FIX Defensively copy mocked datetime 2021-06-05 16:46:19 +12:00
Michal Kleiner
2017a20433 FIX Use empty array as a fallback for preg_split within dbtext summary
If the content is invalid for whatever reason e.g. when instantiating
a DBText field to get a summary of text through
`DBField::create_field('Text', $content)->Summary(10)`, preg_split returns
false and the rest of the code expects an array.
This tweak ensures an array is always returned even when preg_split fails.
2021-06-02 15:17:58 +12:00
Steve Boyd
a3df66860f Merge branch '4.8' into 4 2021-05-31 17:05:11 +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
Sam Minnee
c7c6bdebdf FIX: Allow join-object to be referenced as a component
This avoids having arbitrary differences between a join object and a
has-one relation.
2021-05-20 20:32:25 +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
Nicolaas
2ecd8b34ee
adding use SilverStripe\Security\Member; to make sure linting works
adding `use SilverStripe\Security\Member;` to make sure that linting works.
2021-04-01 23:36:36 +13:00
Nicolaas
504e20320e
Update DBBoolean.php (#9893) 2021-03-24 12:05:33 +13:00
Joe Harvey
33365b92f3 Bug Fix - Ensure DataQuery::exists() SQL is both valid MySQL and T-SQL
The original SQL statement is not valid T-SQL for use with SQL Server
2021-02-08 17:22:20 +00:00
Maxime Rainville
9ca33950a2
API Add a CREATE_MEMORY_HYDRATED option to DataObject constructor (#9767) 2021-01-21 14:07:06 +13:00
3Dgoo
d1cca0f3fb
Fix DataQuery::exists() not working correctly
Fixes `DataQuery::exists()` not working correctly in some cases as discussed in #9809
2021-01-20 17:03:36 -08:00
Steve Boyd
ed5c1488c8
Merge pull request #9817 from creative-commoners/pulls/4/fix-dbcomposite-indexspecs
FIX DBComposite getIndexSpecs method
2021-01-17 11:18:35 +13:00
Ingo Schommer
6153f441ee Merge branch 'phpdoc-fixes' into 4 2021-01-14 11:08:22 +13:00
Serge Latyntcev
2f64667bd6 FIX DBComposite getIndexSpecs method using self API to get the list of db fields 2021-01-07 16:19:54 +13:00
3Dgoo
3b74c2596f
Fix DataQuery::exists() not working correctly
Fixes `DataQuery::exists()` not working correctly in some cases as discussed in #9809
2020-12-29 16:45:58 +10:30
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
af933e8226 MNT Double quote yaml string, fix phpcs warnings 2020-11-30 11:37:35 +13:00
Guy Marriott
b0762593da
Merge branch '4.6' into 4.7 2020-11-17 15:46:54 -08:00
Damian Mooyman
5d45bbdd0d
Update src/ORM/DatabaseAdmin.php
Co-authored-by: Guy Marriott <guy.the.person@gmail.com>
2020-11-13 11:48:50 +13:00
Damian Mooyman
2753516783
Fail over if calling deprecated method 2020-11-13 08:27:53 +13:00
Damian Mooyman
405a1f7cb6
ENHANCEMENT Better optimised class name migration with substantially fewer queries
Fixes #9752
2020-11-12 16:10:28 +13:00
Sergey Shevchenko
51402a9c42
fix: don't use int width for mysql > 8.0.17 #9453 2020-10-29 10:54:52 +13:00
Steve Boyd
6e77d5eada NEW DataObject related objects service 2020-10-29 09:29:26 +13:00
Bernard Hamlin
f00f64120d
NEW Allow setting sql_mode via config (#9721) 2020-10-22 15:01:30 +13:00
Robbie Averill
4d54a2110f Update spaces in syntax, single quotes, early returns where possible 2020-10-01 17:36:14 -07:00
Robbie Averill
ae1e17edec Update exception assertions in tests and remove deprecated annotations 2020-09-25 10:06:49 -07:00
Robbie Averill
27bd5d12e3 ENH Replace E_USER_ERROR errors with exceptions 2020-09-24 23:51:21 -07: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
Steve Boyd
015ea8cfc8 Merge branch '4.6' into 4 2020-09-11 11:54:23 +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
Steve Boyd
02827a6670 FIX Problem with direct compare in SELECT statement causing incompatibility with SQL Server database
Co-authored-by: Tomas Bilek
2020-09-10 14:48:09 +12:00
Steve Boyd
4c3a5441b2 Merge branch '4.6' into 4 2020-09-09 13:58:35 +12:00
Sam Minnee
e0f3797489 FIX: Remove deprecated & non-functional default argument config
This throws deprecation errors on PHP 8.

Fixes #9666
2020-09-07 17:24:00 +12:00
Guy Marriott
ff04f97149
Add return type
Co-authored-by: Robbie Averill <robbie@averill.co.nz>
2020-09-01 08:43:36 -07:00
Guy Marriott
3575070b9d FIX Removing selected column detail only if having is empty (MySQL "feature") 2020-09-01 16:21:43 +12:00
Guy Marriott
f9fc4f6641 FIX Allow for BC for DB adapters that return an actual boolean when selecting boolean literals in SQL 2020-09-01 16:20:07 +12:00
Guy Marriott
ef0af7ae9c FIX Exists statements can't remove GROUP BY if there's a HAVING clause as it might rely on an aggregate 2020-09-01 16:20:07 +12:00
Guy Marriott
91591373d6 NEW Add exists as a method to the DataQuery API that will generate an SQL "exists" query
The exists query in SQL allows the query optimiser (engine specific) to execute these queries much faster - often only needing the presence of an index to return "yes it exists".
2020-09-01 16:20:07 +12:00
Mason Dechaineux
abd0f3fbf3 Fix DataList->column mutating underlying DataQuery 2020-08-21 09:25:27 +10: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
Nicolaas
d292eb8840
PATCH: fix doctype return type hints: add null 2020-07-23 21:10:17 +12:00
Robbie Averill
84b4057a9a
Merge pull request #9406 from chrispenny/feature/standardise-get-cms-validator
v4 improvement: Standardise getCMSValidator for DataObjects/Forms
2020-07-16 15:58:33 -07: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
Ingo Schommer
8d6a248431 Merge remote-tracking branch 'origin/4.6' into 4 2020-07-11 09:07:39 +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
Jackson Darlow
57d75c89d5
NEW Added onAfterBuild (#9545)
* Added onAfterBuild
* Remove arbitrary argument
2020-06-30 16:56:14 +12:00
Steve Boyd
16914bfdfc
Merge pull request #9531 from alessandromarotta/patch-1
DBField Documentation correction
2020-06-30 13:00:20 +12:00
Serge Latyntcev
b4669ad1bb FIX 4.6 regression in the TempDatabase reset schema logic 2020-06-22 16:17:14 +12:00
Guy Marriott
4df45f4fe0
Merge pull request #9550 from jakxnz/pulls/4/docs-regarding-cached-get-ones
Added documentation regarding some cached ORM scenarios
2020-06-17 09:04:07 -07:00
Jackson Darlow
6813c0f7e8 Added documentation regarding some cached ORM scenarios 2020-06-17 17:17:04 +12:00
Jackson Darlow
dfe8d23ffc Added extra type-hints to DataExtension DocBlocks 2020-06-12 13:45:14 +12:00
Jackson Darlow
2175de9560 Adjusted DataExtension DocBlocks to another degree of detail 2020-06-12 10:19:15 +12:00
Jackson Darlow
0d6572a2d6 Added DocBlocks to DataExtension methods 2020-06-11 17:04:45 +12:00
Alessandro Marotta
fa406c1115
Documentation correction 2020-06-02 09:33:52 +02:00
cpenny
d4165db690 Update getter name to getCMSCompositeValidator 2020-05-28 12:23:35 +12:00
cpenny
bca4be77ed Update name to CompositeValidator. Add docblocks 2020-05-28 11:18:46 +12:00
cpenny
11e2005b9b Add deprecation notice for 4.6 and update docs 2020-05-28 11:18:46 +12:00
cpenny
f977f9734c Add base updateValidatorList method to DataExtension 2020-05-28 11:18:46 +12:00
cpenny
b45a3561df Implemented PR feedback. Added some initial test cov 2020-05-28 11:18:46 +12:00
cpenny
d7dd93f7a7 Standardise getCMSValidator for DataObjects/Forms 2020-05-28 11:18:46 +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
Robbie Averill
8bd9f48669
Merge pull request #9501 from mattclegg/1588075087
DOCS: Fix typos & grammer
2020-04-28 09:42:03 -07:00
mattclegg
df8cb9e010
DOCS: Update filter to use correct class 2020-04-28 17:50:40 +05:45
mattclegg
76bc7524a7
DOCS: Fix typos & grammer 2020-04-28 17:50:39 +05:45
Dan Hensby
28ba4f701a
Merge branch '4.5' into 4 2020-04-27 09:54:27 +01:00
Dan Hensby
13b4d60d4a
Merge branch '4.4' into 4.5 2020-04-27 09:53:42 +01:00
Dan Hensby
85b37999be
Merge branch '4.3' into 4.4 2020-04-27 09:52:52 +01:00
Dan Hensby
e328d6f0d9
Merge branch '4.2' into 4.3 2020-04-27 09:51:24 +01:00
Dan Hensby
b9f8ab44ac
Rename DBBigint.php for composer autoloading compatability 2020-04-24 23:15:42 +01:00
Daniel Hensby
237b2d5f74
Convert array delcarations to short array syntax 2020-04-20 18:58:09 +01:00
Serge Latyntcev
cb36aab80c Merge branch '4.5' into 4 2020-04-15 14:49:19 +12:00
Daniel Hensby
03239f9dcc
Merge pull request #9454 from open-sausages/pulls/4/myisam
NEW Allow InnoDB for FULLTEXT indexes
2020-04-14 11:50:45 +01:00
mattclegg
60e670176a
DOCS: Correct spelling 2020-04-14 15:00:08 +05:45
Ingo Schommer
a50e15e5ee FIX Avoid VACUUM on test dbs in Postgres
The Postgres implementation was always faulty,
but the database exception was swallowed until
See https://github.com/silverstripe/silverstripe-framework/pull/9456.

Now that the the exception is only swallowed the first time,
the second recurrence will cause failing test execution.

This is a bit of an awkward fix, but the indirection "through" DataObject doesn't allow for anything else without changing public API surface.
The logic goes from TempDatabase to DBSchemaManager, then through the closure into DataObject->requireTable(),
then back into DBSchemaManager->requireTable(). And updateschema() is subclassed in SQLite3, making it difficult to add more arguments.

VACUUM is described as:

> VACUUM reclaims storage occupied by dead tuples. In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a VACUUM is done. Therefore it's necessary to do VACUUM periodically, especially on frequently-updated tables.

https://www.postgresql.org/docs/9.1/sql-vacuum.html

Since test databases are short-lived, there's no reason to delete dead tuples, they'll be garbage collected when either the transaction is rolled back, or the database is destroyed after the test run.
2020-04-09 14:43:16 +12: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
0215fdd262 DOC Clarify sanitisation in searchEngine() under boolean mode
This came up in https://github.com/silverstripe/silverstripe-cms/issues/1452, and wasn't fully addressed.
Either we allow boolean mode and all the constraints this brings around special character usage,
or we filter out those special characters, which makes boolean mode pointless.
You can't just pass arbitrary user input in a power-user function like this.
See https://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html

Context: This used to work for some examples like "foo>*" under MyISAM,
presumably because it had a more lenient parser. InnoDB rightfully complains about this now.
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