relationshipOrder()

relationshipOrder($linkName, $field, $orderType = "ASC", $override = false)

Works like order() but for getRelationship() calls
@param String $linkName
@param String $field
@param String $orderType
@param Boolean $override
@return PhpBURN_Core

Params


$linkName
Is the name of the relationship that will receive the commands

$field
Wich will order the results, usualy a field but can be anything that your database accepts, ex: $model->order(‘id_user’) or $model->order(‘COUNT(id_user)’), etc.

$field (optional)
By default it comes as “DESC” but you can change to “ASC” anytime you fill this option.

$override (optional)
This will clean all order you setted before in the current model and start again with this.

Explanation


It will help you to order or results putting a ORDER BY mclause in your query.

Default Usage

$user = new Users();
$user->get(1);

$user->relationshipOrder('albums','id_albums','DESC');
$user->getRelationship('albums');

That will bring yours users ORDER BY id_album DESC

For more and detailed information see order() at www.phpburn.com/documentation/orm/order