mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Difference between a single array call vs multiple calls to exclude
This table should best summarise the difference - 1 = row is visible, 0 = row is excluded | Name | SELECT * FROM Player WHERE (FirstName != 'A' OR LastName != 'B') | SELECT * FROM Player WHERE FirstName != 'A' AND LastName != 'B' | | A B | 0 | 0 | | A C | 1 | 0 |
This commit is contained in:
parent
b49d1d7fbd
commit
b044fefc91
@ -401,6 +401,15 @@ Remove both Sam and Sig..
|
||||
'FirstName' => 'Sam',
|
||||
'Surname' => 'Minnée',
|
||||
));
|
||||
|
||||
// SELECT * FROM Player WHERE (FirstName != 'Sam' OR LastName != 'Minnée')
|
||||
|
||||
Removing players with *either* the first name of Sam or the last name of Minnée requires multiple `->exclude` calls:
|
||||
|
||||
:::php
|
||||
$players = Player::get()->exclude('FirstName', 'Sam')->exclude('Surname', 'Minnée');
|
||||
|
||||
// SELECT * FROM Player WHERE FirstName != 'Sam' AND LastName != 'Minnée'
|
||||
|
||||
And removing Sig and Sam with that are either age 17 or 43.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user