Exemplo n.º 1
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
  * @return     void
  */
 public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
 {
     $pos = FormularioPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
     return $this->setByPosition($pos, $value);
 }
Exemplo n.º 2
0
 protected function addSortCriteria($c)
 {
     if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/formulario/sort')) {
         //if ($sort_column_campo = $this->getUser()->getAttribute('sort_campo', null, 'sf_admin/formulario/sort')){
         if ($sort_column != "fecha_form") {
             $c->addAlias("Item2", ItemPeer::TABLE_NAME);
             $c->addAlias("ItemBase2", ItemBasePeer::TABLE_NAME);
             $c->addJoin(FormularioPeer::ID_FORMULARIO, "Item2.ID_FORMULARIO", Criteria::JOIN);
             $c->addJoin("Item2.ID_ITEM_BASE", "ItemBase2.ID_ITEM_BASE", Criteria::JOIN);
             //$sort_column = ItemPeer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
             $sort_column = "Item2." . $sort_column;
             $sort_column_campo = $this->getUser()->getAttribute('sort_campo', null, 'sf_admin/formulario/sort');
             if ($sort_column_campo != null) {
                 $c->addAnd("ItemBase2.ID_CAMPO", $sort_column_campo, Criteria::EQUAL);
             }
         } else {
             $sort_column = FormularioPeer::translateFieldName("fecha", BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
         }
         if ($this->getUser()->getAttribute('type', null, 'sf_admin/formulario/sort') == 'asc') {
             $c->addAscendingOrderByColumn($sort_column);
         } else {
             $c->addDescendingOrderByColumn($sort_column);
         }
     }
 }