public function nuevoAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post_data = $request->getPost();
         $entity = new \Categoriagasto();
         foreach ($post_data as $key => $value) {
             if (\CategoriagastoPeer::getTableMap()->hasColumn($key) && !empty($value)) {
                 $entity->setByName($key, $value, \BasePeer::TYPE_FIELDNAME);
             }
         }
         $entity->save();
         //Agregamos un mensaje
         $this->flashMessenger()->addSuccessMessage('Registro guardado exitosamente!');
         //REDIRECCIONAMOS A LA ENTIDAD QUE ACABAMOS DE CREAR
         return $this->redirect()->toRoute('admin/catalogo/catergoria-gastos', array('action' => 'editar', 'id' => $entity->getIdcategoriagasto()));
     }
     //INSTANCIAMOS NUESTRO FORMULARIO
     $form = new \Catalogo\Form\CategoriagastosForm();
     //RETORNAMOS A NUESTRA VISTA
     $view_model = new ViewModel();
     $view_model->setTemplate('admin/catalogo/categoriasgastos/nuevo');
     $view_model->setVariable('form', $form);
     return $view_model;
 }
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->collExpedientegastos) {
             foreach ($this->collExpedientegastos as $o) {
                 $o->clearAllReferences($deep);
             }
         }
         if ($this->aCategoriagasto instanceof Persistent) {
             $this->aCategoriagasto->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     if ($this->collExpedientegastos instanceof PropelCollection) {
         $this->collExpedientegastos->clearIterator();
     }
     $this->collExpedientegastos = null;
     $this->aCategoriagasto = null;
 }
 /**
  * Filter the query by a related Categoriagasto object
  *
  * @param   Categoriagasto|PropelObjectCollection $categoriagasto The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 GastofacturacionQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByCategoriagasto($categoriagasto, $comparison = null)
 {
     if ($categoriagasto instanceof Categoriagasto) {
         return $this->addUsingAlias(GastofacturacionPeer::IDCATEGORIAGASTO, $categoriagasto->getIdcategoriagasto(), $comparison);
     } elseif ($categoriagasto instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(GastofacturacionPeer::IDCATEGORIAGASTO, $categoriagasto->toKeyValue('PrimaryKey', 'Idcategoriagasto'), $comparison);
     } else {
         throw new PropelException('filterByCategoriagasto() only accepts arguments of type Categoriagasto or PropelCollection');
     }
 }
 /**
  * Exclude object from result
  *
  * @param   Categoriagasto $categoriagasto Object to remove from the list of results
  *
  * @return CategoriagastoQuery The current query, for fluid interface
  */
 public function prune($categoriagasto = null)
 {
     if ($categoriagasto) {
         $this->addUsingAlias(CategoriagastoPeer::IDCATEGORIAGASTO, $categoriagasto->getIdcategoriagasto(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param Categoriagasto $obj A Categoriagasto object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getIdcategoriagasto();
         }
         // if key === null
         CategoriagastoPeer::$instances[$key] = $obj;
     }
 }