mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Throw exception when "value" is used to define indexes. Update docs.
This commit is contained in:
parent
364a14da1d
commit
5d5fac7450
@ -71,6 +71,11 @@ support the following:
|
||||
}
|
||||
```
|
||||
|
||||
<div class="alert" markdown="1">
|
||||
Please note that if you have previously used the removed `value` key to define an index's contents, SilverStripe will
|
||||
now throw an error. Use `columns` instead.
|
||||
</div>
|
||||
|
||||
## Complex/Composite Indexes
|
||||
For complex queries it may be necessary to define a complex or composite index on the supporting object. To create a
|
||||
composite index, define the fields in the index order as a comma separated list.
|
||||
|
@ -1242,7 +1242,7 @@ use SilverStripe\ORM\DataObject;
|
||||
*/
|
||||
class MyStagedModel extends SilverStripe\ORM\DataObject
|
||||
{
|
||||
private staic $extensions = [
|
||||
private static $extensions = [
|
||||
"SilverStripe\\ORM\\Versioning\\Versioned('StagedVersioned')"
|
||||
];
|
||||
}
|
||||
@ -1971,6 +1971,7 @@ A very small number of methods were chosen for deprecation, and will be removed
|
||||
* `ChangeSet` and `ChangeSetItem` have been added for batch publishing of versioned dataobjects.
|
||||
* `DataObject.table_name` config can now be used to customise the database table for any record.
|
||||
* `DataObjectSchema` class added to assist with mapping between classes and tables.
|
||||
* `DataObject.indexes` now uses `columns` instead of `value` to define index contents.
|
||||
* `DBMoney` values are now treated as empty only if `Amount` field is null. If an `Amount` value
|
||||
is provided without a `Currency` specified, it will be formatted as per the current locale.
|
||||
* Removed `DatabaseAdmin#clearAllData()`. Use `DB::get_conn()->clearAllData()` instead
|
||||
|
@ -558,8 +558,18 @@ abstract class DBSchemaManager
|
||||
protected function convertIndexSpec($indexSpec)
|
||||
{
|
||||
// Return already converted spec
|
||||
if (!is_array($indexSpec) || !array_key_exists('type', $indexSpec) || !array_key_exists('columns', $indexSpec) || !is_array($indexSpec['columns'])) {
|
||||
throw new \InvalidArgumentException(sprintf('argument to convertIndexSpec must be correct indexSpec, %s given', var_export($indexSpec, true)));
|
||||
if (!is_array($indexSpec)
|
||||
|| !array_key_exists('type', $indexSpec)
|
||||
|| !array_key_exists('columns', $indexSpec)
|
||||
|| !is_array($indexSpec['columns'])
|
||||
|| array_key_exists('value', $indexSpec)
|
||||
) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
'argument to convertIndexSpec must be correct indexSpec, %s given',
|
||||
var_export($indexSpec, true)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Combine elements into standard string format
|
||||
|
Loading…
Reference in New Issue
Block a user