Skip to content

Commit

Permalink
DOC Document change to ArrayList case sensitivity (#665)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Jan 7, 2025
1 parent 2ddd7d2 commit 9836332
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
11 changes: 2 additions & 9 deletions en/02_Developer_Guides/00_Model/06_SearchFilters.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,19 @@ $players = Player::get()->filterAny([
Developers can define their own [SearchFilter](api:SilverStripe\ORM\Filters\SearchFilter) if needing to extend the ORM filter and exclude behaviors.

## Modifiers
## Modifiers and case sensitivity {#modifiers}

`SearchFilter`s can also take modifiers. The modifiers currently supported are `":not"`, `":nocase"`, and
`":case"` (though you can implement custom modifiers on your own `SearchFilter` implementations). These negate the filter, make it case-insensitive and make it case-sensitive, respectively.

> [!NOTE]
> The default comparison uses the database's default case sensitivity. For MySQL and MSSQL, this is case-insensitive. For PostgreSQL, this is case-sensitive. But you can declare the default
> The default comparison uses the database's default case sensitivity (even for `ArrayList`). For MySQL and MSSQL, this is case-insensitive. For PostgreSQL, this is case-sensitive. But you can declare the default
> case sensitivity for your project by setting the `default_case_sensitive` configuration property on `SearchFilter` like so:
>
> ```yml
> SilverStripe\ORM\Filters\SearchFilter:
> default_case_sensitive: false
> ```
>
> Though note that for backwards compatibility reasons, `ArrayList` is explicitly case sensitive by default. To change that, you must set `ArrayList.default_case_sensitive` to false.
>
> ```yml
> SilverStripe\Model\List\ArrayList:
> default_case_sensitive: false
> ```
```php
// Fetch players that their FirstName is exactly 'Sam'
Expand Down
1 change: 1 addition & 0 deletions en/08_Changelogs/6.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,7 @@ As part of these changes [`ArrayList::find()`](api:SilverStripe\Model\List\Array
- `DNADesign\Elemental\Models\BaseElement::getDescription()` and the corresponding `DNADesign\Elemental\Models\BaseElement.description` configuration property have been removed. If you were using either of these in your custom elemental blocks, either set the new [`class_description`](api:SilverStripe\ORM\DataObject->class_description) configuration property or override one of the [`i18n_classDescription()`](api:SilverStripe\ORM\DataObject::i18n_classDescription()) or [`getTypeNice()`](api:DNADesign\Elemental\Models\BaseElement::getTypeNice()) methods instead.
- `SilverStripe\ORM\DataExtension`, `SilverStripe\CMS\Model\SiteTreeExtension`, and `SilverStripe\Admin\LeftAndMainExtension` have been removed. If you subclass any of these classes, you must now subclass [`Extension`](api:SilverStripe\Core\Extension) directly instead.
- [`DBCurrency`](api:SilverStripe\ORM\FieldType\DBCurrency) will no longer parse numeric values contained in a string when calling `setValue()`. For instance "this is 50.29 dollars" will no longer be converted to "$50.29", instead its value will remain as "this is 50.29 dollars" and it will throw a validation exception if attempted to be written to the database.
- The `SilverStripe\Model\List\ArrayList.default_case_sensitive` configuration property has been removed. This means the default case sensitivity of `ArrayList` is now the same as any other list which uses search filters. If you were using that configuration property, or you were relying on `ArrayList` being case sensitive by default, you should double check that your list filters are working the way you expect. See [search filters](/developer_guides/model/searchfilters/#modifiers) for details about case sensitivity in search filters.

## Other changes

Expand Down

0 comments on commit 9836332

Please sign in to comment.