DOCS Note inability to filter on null

This commit is contained in:
Jono Menz 2019-10-14 12:58:52 -07:00 committed by GitHub
parent 837507e63b
commit 48d3d9ca49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -321,6 +321,14 @@ exact match.
'FirstName:StartsWith' => 'S' 'FirstName:StartsWith' => 'S'
'PlayerNumber:GreaterThan' => '10' 'PlayerNumber:GreaterThan' => '10'
)); ));
<div class="notice" markdown='1'>
Please note that in SilverStripe 3.x it's not possible to filter a list based on a field containing a `null` value (see [this issue](https://github.com/silverstripe/silverstripe-framework/issues/3621) for context). You can workaround this with a `where` statement, for example:
:::php
$unsponsoredPlayers = Player::get()->where("\"MainSponsor\" IS NULL OR \"MainSponsor\" = ''");
</div>
### filterAny ### filterAny