public function getconceptosAction() { $collection = \ConceptobancoQuery::create()->find()->toArray(null, false, \BasePeer::TYPE_FIELDNAME); $conceptos_autcomplete = array(); foreach ($collection as $entity) { $tmp['value'] = $entity["idbancotransaccion"]; $tmp['label'] = $entity["bancotransaccion_nombre"]; $conceptos_autcomplete[] = $tmp; } return $this->getResponse()->setContent(\Zend\Json\Json::encode($conceptos_autcomplete)); }
public function eliminarAction() { $request = $this->getRequest(); //Cachamos el valor desde nuestro params $id = (int) $this->params()->fromRoute('id'); //Verificamos que el Id lugar que se quiere modificar exista if (!\ConceptobancoQuery::create()->filterByIdbancotransaccion($id)->exists()) { $id = 0; } //Si es incorrecto redireccionavos al action nuevo if (!$id) { return $this->redirect()->toRoute('bancos-concepto', array('action' => 'nuevo')); } //Instanciamos nuestro lugar $entity = \ConceptobancoQuery::create()->findPk($id); $entity->delete(); //Agregamos un mensaje $this->flashMessenger()->addMessage('Concepto eliminado exitosamente!'); //Redireccionamos a nuestro list return $this->redirect()->toRoute('bancos-concepto'); }
/** * Removes this object from datastore and sets delete attribute. * * @param PropelPDO $con * @return void * @throws PropelException * @throws Exception * @see BaseObject::setDeleted() * @see BaseObject::isDeleted() */ public function delete(PropelPDO $con = null) { if ($this->isDeleted()) { throw new PropelException("This object has already been deleted."); } if ($con === null) { $con = Propel::getConnection(ConceptobancoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); } $con->beginTransaction(); try { $deleteQuery = ConceptobancoQuery::create()->filterByPrimaryKey($this->getPrimaryKey()); $ret = $this->preDelete($con); if ($ret) { $deleteQuery->delete($con); $this->postDelete($con); $con->commit(); $this->setDeleted(true); } else { $con->commit(); } } catch (Exception $e) { $con->rollBack(); throw $e; } }
/** * Get the associated Conceptobanco object * * @param PropelPDO $con Optional Connection object. * @param $doQuery Executes a query to get the object if required * @return Conceptobanco The associated Conceptobanco object. * @throws PropelException */ public function getConceptobanco(PropelPDO $con = null, $doQuery = true) { if ($this->aConceptobanco === null && $this->idconceptobanco !== null && $doQuery) { $this->aConceptobanco = ConceptobancoQuery::create()->findPk($this->idconceptobanco, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aConceptobanco->addBancos($this); */ } return $this->aConceptobanco; }