src/orm/classes/Helper/Ordering.php
public function moveUp(ORM_Entity $entity)
    {
        if (0 == $entity->{$this->fieldName})
        {
            // Выше некуда
            return;
        }
        $table = $entity->getTable();
        $q = $table->createSelectQuery(false);
        $e = $q->expr;
        $group = array();
        foreach ($this->groupBy as $field)
        {
            $group []= $e->eq($field, $q->bindValue($entity->$field));
        }
        $group []= $e->lt($this->fieldName, $q->bindValue($entity->{$this->fieldName}, null,
            PDO::PARAM_INT));
        $q->select('*');
        $q->where(call_user_func_array(array($e, 'lAnd'), $group))->
            orderBy($this->fieldName, ezcQuerySelect::DESC);
        $swap = $table->loadOneFromQuery($q);

        if (!$swap)
        {
            // Выше некуда
            return;
        }

        $this->swap($table, $entity, $swap);
    }
public function moveUp(ORM_Entity $entity)
    {
        if (0 == $entity->{$this->fieldName})
        {
            // Выше некуда
            return;
        }
        $table = $entity->getTable();
        $q = $table->createSelectQuery(false);
        $e = $q->expr;
        $group = array();
        foreach ($this->groupBy as $field)
        {
            $group []= $e->eq($field, $q->bindValue($entity->$field));
        }
        $group []= $e->lt($this->fieldName, $q->bindValue($entity->{$this->fieldName}, null,
            PDO::PARAM_INT));
        $q->select('*');
        $q->where(call_user_func_array(array($e, 'lAnd'), $group))->
            orderBy($this->fieldName, ezcQuerySelect::DESC);
        $swap = $table->loadOneFromQuery($q);

        if (!$swap)
        {
            // Выше некуда
            return;
        }

        $this->swap($table, $entity, $swap);
    }
Перемещает запись выше в группе
@param ORM_Entity $entity

@return void

@since 1.00