Download the PHP package colybri/criteria without Composer
On this page you can find all versions of the php package colybri/criteria. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download colybri/criteria
More information about colybri/criteria
Files in colybri/criteria
Package criteria
Short Description Helper classes for implement filter/criteria pattern
License MIT
Informations about the package criteria
Criteria
This package allows build customized criteria and any kind of filters and also include an adapter for use with Doctrine Database Abstraction Layer.
Domain Driven Design series
This package is the first of a series of high level building blocks to build your applications with Domain Driven Design approach.
- Criteria
Table of contents
- Installation
- Usage
- Create a criteria
- Specify order
- Limit results
- Nested filters
- Adapter
- Dbal adapter
- Map database fields
Installation
Via Composer
Usage
Create a criteria
A filter is composed by three objects. First is field key to match with your key/value map of field's names of your columns on database. Second parameter is the operator you want to use on your condition. The last one is the value you want to match.
Specify order
First parameter is the key of the field for order result. Secondly, order type.
Limit results
If you don't want to limit your results simply set null
to the two last parameters of Criteria
. Otherwise set offset and limit.
Nested filters
In order use logic operator OR
or nested conditions.
Adapter
Dbal adapter
In your repository:
Map database fields
In the above example CountryMap
is a simple class that must implement EntityMap
interface. As show bellow. The attribute FIELDS
is a key/value array where the key is the semantic name that you use on your domain and the value is the column name that match on database.