Contents
- Basic Concepts
- Models and Schemas
- Column Types
- Collections
- Filtering
- Groups
- Inverting Filters (not)
- Back references
- Advanced Filters
- Creating Your Own Filter
- Default Filters
- Relationships
- Data Decorators
- Data Storage and Typing
- Repositories
- Data Typing and Data Transforms
- Advanced Techniques
- Joins and Intersections
- Aggregates
- Model Events
- Custard Commands
- Updating DocBlock comments
- Migrating Schemas
- Common Patterns and Anti-Patterns
- Inter-Model Strategies
Not
Not filters are used to invert whatever the filter supplied in the constructor does. i.e. to include what the other filter excludes and to exclude what the other filter includes.
Creating a Not filter
You can either construct a Not filter object and pass the filter to invert in the constructor or you can call the
getInvertedFilter()
function on the existing filter.
// People not called John
$notEquals = new Not(new Equals("FirstName", "John"));
// Same again
$notEquals = (new Equals("FirstName", "John"))->getInvertedFilter();
This works with all other filters including groups. This example will remove all models called Jo Johnson.
$filterGroup = new AndGroup(
new Contains("Forename", "Jo"),
new Contains("Surname", "Johnson")
);
$notFilter = new Not($filterGroup);