kernel/classes/ezpersistentobject.php
public static function newObjectOrder( $def, $orderField, $conditions )
    {
        $db = eZDB::instance();
        $table = $def["name"];
        $keys = $def["keys"];

        $cond_text = eZPersistentObject::conditionText( $conditions );
        $rows = $db->arrayQuery( "SELECT MAX($orderField) AS $orderField FROM $table $cond_text" );
        if ( count( $rows ) > 0 and isset( $rows[0][$orderField] ) )
            return $rows[0][$orderField] + 1;
        else
            return 1;
    }
public static function newObjectOrder( $def, $orderField, $conditions )
    {
        $db = eZDB::instance();
        $table = $def["name"];
        $keys = $def["keys"];

        $cond_text = eZPersistentObject::conditionText( $conditions );
        $rows = $db->arrayQuery( "SELECT MAX($orderField) AS $orderField FROM $table $cond_text" );
        if ( count( $rows ) > 0 and isset( $rows[0][$orderField] ) )
            return $rows[0][$orderField] + 1;
        else
            return 1;
    }
public static function newObjectOrder ( $ def , $ orderField , $ conditions ) { $ db = eZDB :: instance ( ) ; $ table = $ def [ "name" ] ; $ keys = $ def [ "keys" ] ; $ cond_text = eZPersistentObject :: conditionText ( $ conditions ) ; $ rows = $ db -> arrayQuery ( "SELECT MAX($orderField) AS $orderField FROM $table $cond_text" ) ; if ( count ( $ rows ) > 0 and isset ( $ rows [ 0 ] [ $ orderField ] ) ) return $ rows [ 0 ] [ $ orderField ] + 1 ; else return 1 ; }
Returns an order value which can be used for new items in table,
for instance placement.

Uses $def, $orderField and $conditions to figure out the currently maximum
order value and returns one that is larger.

@param array $def A definition array of all fields, table name and sorting (see {@link eZPersistentObject::definition()} for more info)
@param string $orderField
@param array $conditions
@return int
Returns an order value which can be used for new items in table for instance placement .