When you create a model with upper case columns, the generated method addSortCriteria throws an propel exception because the column to sort is not found.
This exception is thrown by the xxxPeer::translateFieldName method, because $sort_column is in lower case, and it should be in upper case.
protected function addSortCriteria ($c)
{
if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/utilisateur/sort'))
{
$sort_column = UtilisateurPeer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
An extract of a peer class :
<?php
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('UtId' => 0, 'Nom' => 1, 'Prenom' => 2 ),
BasePeer::TYPE_COLNAME => array (UtilisateurPeer::UT_ID => 0, UtilisateurPeer::NOM => 1, UtilisateurPeer::PRENOM => 2),
BasePeer::TYPE_FIELDNAME => array ('UT_ID' => 0, 'NOM' => 1, 'PRENOM' => 2 ),
BasePeer::TYPE_NUM => array (0, 1, 2)
);
[...]
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
?>