BEdita API doc | 4-cactus
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Download

Namespaces

  • BEdita
    • API
      • Auth
      • Controller
        • Admin
        • Component
        • Model
      • Error
      • Event
      • Exception
      • Middleware
      • Model
        • Action
      • Network
        • Exception
      • Shell
      • TestSuite
      • Utility
    • Core
      • Configure
        • Engine
      • Database
        • Type
      • Exception
      • Filesystem
        • Adapter
        • Exception
        • Thumbnail
      • I18n
      • Job
        • Service
      • Mailer
        • Preview
        • Transport
      • Model
        • Action
        • Behavior
        • Entity
        • Table
        • Validation
      • ORM
        • Inheritance
        • Locator
        • Rule
      • Shell
        • Task
      • State
      • TestSuite
        • Fixture
      • Utility

Traits

  • QueryFilterTrait

Trait QueryFilterTrait

Query Filter trait.

Direct Known Users

BEdita\Core\Model\Action\ListEntitiesAction

Namespace: BEdita\Core\ORM
Since: 4.0.0
Located at Core/src/ORM/QueryFilterTrait.php

Methods summary

public Cake\ORM\Query
# fieldsFilter( Cake\ORM\Query $query, array $options )

Create query filter using various operators on fields Options array must contain fields as keys and operators like - 'gt' or '>' (greather than) - 'lt' or '<' (less than), - 'ge' or '>=' (greater or equal) - 'le' or '<=' (less or equal) with a date

Create query filter using various operators on fields Options array must contain fields as keys and operators like - 'gt' or '>' (greather than) - 'lt' or '<' (less than), - 'ge' or '>=' (greater or equal) - 'le' or '<=' (less or equal) with a date

It's also possible to specify an expected value or a list of values for a field

Options array examples:

// field1 greater than 10, field2 less then 5
['field1' => ['gt' => 10], 'field2' => ['lt' => 5]];

// field1 in [1, 3, 10]
['field1' => [1, 3, 10]];

// a comma separated string has the same effect as a list of values
['field1' => '1,3,10'];

// field1 equals 10, field2 equals 1
['field1' => 10, 'field1' => ['eq' => 1]];

// field1 greater or equal 5, field2 less or equal 4
['field1' => ['>=' => 10], 'field2' => ['<=' => 4]];

// field1 is null, field2 is not null, field3 is null
['field1' => ['null' => 1], 'field2' => ['null' => 0], 'field3' => null];

//

Parameters

$query
Query object instance.
$options
Array of acceptable fields and conditions.

Returns

Cake\ORM\Query
protected Cake\Database\Expression\QueryExpression
# operatorExpression( Cake\Database\Expression\QueryExpression $exp, string $operator, string $field, string $value )

Get query expression for an operator on a field with a value. Unrecognized operators are ignored and have no effect.

Get query expression for an operator on a field with a value. Unrecognized operators are ignored and have no effect.

Parameters

$exp
Current query expression
$operator
Filter operator
$field
Filter field
$value
Filter value

Returns

Cake\Database\Expression\QueryExpression
Operator query expression
BEdita API doc | 4-cactus API documentation generated by ApiGen