class OrderBy extends AbstractNode (View source)

Factory node for order by.

Query results can be ordered by any dynamic operand in either ascending or descending order.

Constants

NT_BUILDER

NT_CONSTRAINT

NT_CONSTRAINT_FACTORY

NT_FROM

NT_OPERAND_DYNAMIC

NT_OPERAND_DYNAMIC_FACTORY

NT_OPERAND_STATIC

NT_OPERAND_FACTORY

NT_ORDERING

NT_ORDER_BY

NT_PROPERTY

NT_SELECT

NT_SOURCE

NT_SOURCE_FACTORY

NT_SOURCE_JOIN_CONDITION

NT_SOURCE_JOIN_CONDITION_FACTORY

NT_SOURCE_JOIN_LEFT

NT_SOURCE_JOIN_RIGHT

NT_WHERE

NT_WHERE_AND

NT_WHERE_OR

Properties

protected $children from AbstractNode
protected $parent from AbstractNode

Methods

__construct(AbstractNode $parent = null)

No description

string
getNodeType()

Return the type of node.

getParent()

Return the parent of this node.

string
getName()

Return the last part of the this classes FQN (i.e. the basename).

array
getCardinalityMap()

Return the cardinality map for this node.

setChild(AbstractNode $node)

Remove any previous children and add given node via. addChild.

addChild(AbstractNode $node)

Add a child to this node.

getNext()

Return the next object in the fluid interface chain. Leaf nodes always return the parent, deafult behavior is to return /this/ class.

getChildren()

Return all child nodes.

getChildrenOfType(string $type)

Return children of specified type.

removeChildrenOfType($type)

No description

getChild()

Return child of node, there must be exactly one child of any type.

getChildOfType(string $type)

Return child of specified type.

validate()

Validate the current node.

end()

Validates this node and returns its parent.

__call(string $methodName, array $args)

Catch any undefined method calls and tell the developer what methods can be called.

ensureNoArguments($method, $void)

No description

getFactoryMethods()

No description

asc()

Add ascending ordering::.

desc()

Add descending ordering::.

Details

__construct(AbstractNode $parent = null)

Parameters

AbstractNode $parent

string getNodeType()

Return the type of node.

Must be one of self::NT_*

Return Value

string

AbstractNode getParent()

Return the parent of this node.

Return Value

AbstractNode

final string getName()

Return the last part of the this classes FQN (i.e. the basename).

This should only be used when generating exceptions This is also used to determine the dispatching method -- should it be?

Return Value

string

array getCardinalityMap()

Return the cardinality map for this node.

e.g. array( self::NT_JOIN_CONDITION => array(1, 1), // require exactly 1 join condition self::NT_SOURCE => array(2, 2), // exactly 2 sources );

or: array( self::NT_PROPERTY => array(1, null), // require one to many Columns );

or: array( self::NT_PROPERTY => array(null, 1), // require none to 1 properties );

Return Value

array

AbstractNode setChild(AbstractNode $node)

Remove any previous children and add given node via. addChild.

Parameters

AbstractNode $node

Return Value

AbstractNode

See also

removeChildrenOfType
addChild

AbstractNode addChild(AbstractNode $node)

Add a child to this node.

Exception will be thrown if child node type is not described in the cardinality map, or if the maxiumum permitted number of nodes would be exceeded by adding the given child node.

The given node will be returned EXCEPT when the current node is a leaf node, in which case we return the parent.

Parameters

AbstractNode $node

Return Value

AbstractNode

Exceptions

OutOfBoundsException

AbstractNode getNext()

Return the next object in the fluid interface chain. Leaf nodes always return the parent, deafult behavior is to return /this/ class.

Return Value

AbstractNode

AbstractNode[] getChildren()

Return all child nodes.

Note that this will returned a flattened version of the classes type => children map.

Return Value

AbstractNode[]

AbstractNode[] getChildrenOfType(string $type)

Return children of specified type.

Parameters

string $type The type name.

Return Value

AbstractNode[]

removeChildrenOfType($type)

Parameters

$type

AbstractNode getChild()

Return child of node, there must be exactly one child of any type.

Return Value

AbstractNode

Exceptions

OutOfBoundsException if there are more than one or none

AbstractNode getChildOfType(string $type)

Return child of specified type.

Note: This does not take inheritance into account.

Parameters

string $type The name of the type.

Return Value

AbstractNode

Exceptions

OutOfBoundsException if there are more than one or none

validate()

Validate the current node.

Validation is performed both when the query is being built and when the dev explicitly calls "end()".

This method simply checks the minimum boundries are satisfied, the addChild() method already validates maximum boundries and types.

AbstractNode end()

Validates this node and returns its parent.

This should be used if the developer wants to define the entire Query in a fluid manner.

Return Value

AbstractNode

__call(string $methodName, array $args)

Catch any undefined method calls and tell the developer what methods can be called.

Parameters

string $methodName The requested nonexistent method.
array $args The arguments that where used.

Exceptions

BadMethodCallException if an unknown method is called.

ensureNoArguments($method, $void)

Parameters

$method
$void

getFactoryMethods()

Ordering asc()

Add ascending ordering::.

$qb->orderBy()->asc()->field('sel_1.prop_1')->end();

Return Value

Ordering

Ordering desc()

Add descending ordering::.

$qb->orderBy()->desc()->field('sel_1.prop_1')->end();

Return Value

Ordering