PHP Class MatchObjectFilter, silvershop-core

Combining fields defines a way to uniquely identify an object. Useful for finding if a dataobject with given field values exists. Protects against SQL injection, and searching on unauthroised fields. Ignores fields that don't exist on the object. Adds IS NULL, or = 0 for values that are not passed. Similar to SearchContext Conjunctive query Example input: $data = array( 'FieldName' => 'data' 'AnotherField' => 32, 'NotIncludedField' => 'blah' ); $required = array( 'FieldName', 'AnotherField', 'ARequiredField' ); Example output: "FieldName" = 'data' AND "AnotherField" = 32 AND "ARequiredField" IS NULL
Show file Open project: burnbright/silverstripe-shop Class Usage Examples

Protected Properties

Property Type Description
$className
$data
$required

Public Methods

Method Description
__construct ( string $className, array $data, array $requiredfields )
getFilter ( ) : array Create SQL where filter

Method Details

__construct() public method

public __construct ( string $className, array $data, array $requiredfields )
$className string
$data array field values to use
$requiredfields array fields required to be included in the query

getFilter() public method

Create SQL where filter
public getFilter ( ) : array
return array of filter statements

Property Details

$className protected property

protected $className

$data protected property

protected $data

$required protected property

protected $required