Tuskfish API V1.1.1
  • Package
  • Class

Packages

  • content
  • core
  • database
  • installation
  • security
  • user
  • utilities

Classes

  • TfCriteria
  • TfCriteriaFactory
  • TfCriteriaItem
  • TfDatabase

Class TfCriteria

Sets conditions on database queries, used to compose a query.

Use this class to set parameters on database-related actions. Individual conditions are held within the item property, as TfCriteriaItem objects. Criteria holds the basic query parameters and controls how TfCriteriaItem are chained together (eg. with "AND", "OR").

See the Tuskfish Developer Guide for a full explanation and examples.

TfCriteria uses TfMagicMethods
Package: database
Copyright: Simon Wilkinson 2013+ (https://tuskfish.biz)
License: GNU General Public License (GPL) V2
Author: Simon Wilkinson simon@isengard.biz
Version: Release: 1.0
Since: 1.0
Uses: trait TfMagicMethods Prevents direct setting of properties / unlisted properties.
Located at trust_path/libraries/tuskfish/class/TfCriteria.php

Methods summary

public
# __construct( TfValidator $validator )

Constructor.

Constructor.

Parameters

$validator
An instance of the Tuskfish data validator class.
public
# add( TfCriteriaItem $criteriaItem, string $condition = "AND" )

Add conditions (TfCriteriaItem) to a query.

Add conditions (TfCriteriaItem) to a query.

Parameters

$criteriaItem
TfCriteriaItem object.
$condition
Condition used to chain TfCriteriaItems, "AND" or "OR" only.
public
# setGroupBy( string $groupBy )

Set a GROUP BY condition on a query.

Set a GROUP BY condition on a query.

Parameters

$groupBy
Column to group results by.
public
# setLimit( integer $limit )

Sets a limit on the number of database records to retrieve in a database query.

Sets a limit on the number of database records to retrieve in a database query.

Parameters

$limit
The number of records to retrieve.
public
# setOffset( integer $offset )

Sets an offset (starting point) for retrieving records in a database query.

Sets an offset (starting point) for retrieving records in a database query.

Parameters

$offset
The record to start retrieving results from, from a result set.
public
# setOrder( string $order )

Sets the primary column to order query results by.

Sets the primary column to order query results by.

Parameters

$order
Name of the primary column to order the query results by.
public
# setOrderType( string $orderType )

Sets the sort type (ascending or descending) for the primary order column of a result set.

Sets the sort type (ascending or descending) for the primary order column of a result set.

Parameters

$orderType
Ascending (ASC) or descending (DESC) order.
public
# setSecondaryOrder( string $secondaryOrder )

Sets the secondary column to order query results by.

Sets the secondary column to order query results by.

Parameters

$secondaryOrder
Name of the secondary column to order the query results by.
public
# setSecondaryOrderType( string $secondaryOrderType )

Sets the secondary column to order query results by.

Sets the secondary column to order query results by.

Parameters

$secondaryOrderType

order Name of the secondary column to order the query results by.

public
# setTag( array $tags )

Set tag(s) to filter query results by.

Set tag(s) to filter query results by.

Parameters

$tags
Array of tag IDs to be used to filter a query.
public
# unsetType( integer $key )

Unset existing type criteria.

Unset existing type criteria.

Used by content object handler subclasses to remove any existing type filter when they may need to set or reset it to a specific type.

Parameters

$key
Key of the item array containing the type filter.

Methods used from TfMagicMethods

__get(), __isset(), __set(), __unset()

Properties summary

protected $validator
#
protected array $item
# array()
protected array $condition
# array()
protected string $groupBy
# ''
protected integer $limit
# 0
protected integer $offset
# 0
protected string $order
# ''
protected string $orderType
# "DESC"
protected string $secondaryOrder
# ''
protected string $secondaryOrderType
# "DESC"
protected array $tag
# array()

Magic properties

public TfValidator $validator

Instance of the Tuskfish data validator class.

public array $item

Array of TfCriteriaItem.

public array $condition

Array of conditions used to join TfCriteriaItem (AND, OR).

public string $groupBy

Column to group results by.

public integer $limit

Number of records to retrieve.

public integer $offset

Starting point for retrieving records.

public string $order

Primary column to sort records by.

public string $orderType

Sort ascending (ASC) or descending(DESC).

public string $secondaryOrder

secondary column to sort records by.

public string $secondaryOrderType

Sort ascending (ASC) or descending (DESC).

public array $tag

Array of tag IDs.

Tuskfish API V1.1.1 API documentation generated by ApiGen