Exemple #1
0
 protected function processSort($query)
 {
     $sort = $this->getSort();
     if (array(null, null) == $sort) {
         return;
     }
     try {
         $column = ProductoPeer::translateFieldName($sort[0], BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_PHPNAME);
     } catch (PropelException $e) {
         // probably a fake column, using a custom orderByXXX() query method
         $column = sfInflector::camelize($sort[0]);
     }
     $method = sprintf('orderBy%s', $column);
     try {
         $query->{$method}('asc' == $sort[1] ? 'asc' : 'desc');
     } catch (PropelException $e) {
         // non-existent sorting method
         // ignore the sort parameter
         $this->setSort(array(null, null));
     }
 }
Exemple #2
0
 /**
  * Sets a field from the object by name passed in as a string.
  *
  * @param string $name peer name
  * @param mixed $value field value
  * @param string $type The type of fieldname the $name is of:
  *                     one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
  *                     BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  *                     Defaults to BasePeer::TYPE_PHPNAME
  * @return void
  */
 public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
 {
     $pos = ProductoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
     $this->setByPosition($pos, $value);
 }