- NAME
- DESCRIPTION
- METHODS
  - LimitToObjectId
- METHODS FOR TARGETS
  - LimitTargetToNotAdded
  - LimitTargetToAdded
  - JoinTargetToAdded
  - JoinTargetToThis

# NAME

RT::SearchBuilder::AddAndSort - base class for 'add and sort' collections

# DESCRIPTION

Base class for collections where records can be added to objects with order. See also RT::Record::AddAndSort. Used by RT::ObjectScrips and RT::ObjectCustomFields.

As it's about sorting then collection is sorted by SortOrder field.

# METHODS

## LimitToObjectId

Takes id of an object and limits collection.

# METHODS FOR TARGETS

Rather than implementing a base class for targets (RT::Scrip, RT::CustomField) and its collections. This class provides class methods to limit target collections.

## LimitTargetToNotAdded

Takes a collection object and optional list of object ids. Limits the collection to records not added to listed objects or if the list is empty then any object. Use 0 (zero) to mean global.

## LimitTargetToAdded

"LimitTargetToNotAdded" with reverse meaning. Takes the same arguments.

## JoinTargetToAdded

Joins collection to this table using left join, limits joined table by ids if those are provided.

Returns alias of the joined table. Join is cached and re-used for multiple calls.

## JoinTargetToThis

Joins target collection to this table using TargetField.

Takes New and Left arguments. Use New to avoid caching and re-using this join. Use Left to create LEFT JOIN rather than inner.

← Back to index