/** * Devuelve todas las oficinas de un Banco * indicado en la posicion 2 del request. * @return array */ public function listAction($idBanco = '') { if ($idBanco == '') { $idBanco = $this->request[2]; } $oficinas = new BancosOficinas(); $tabla = $oficinas->getDataBaseName() . "." . $oficinas->getTableName(); unset($oficinas); $filtro = $tabla . ".IDBanco='" . $this->request[2] . "'"; $this->values['linkBy']['value'] = $idBanco; return parent::listAction($filtro); }
/** * Borra un banco y sus oficinas * * @return boolean */ public function erase() { $this->conecta(); $oficinas = new BancosOficinas(); if (is_resource($this->_dbLink)) { $query = "DELETE FROM {$this->_dataBaseName}.{$this->_tableName} WHERE `IDBanco`='{$this->IDBanco}'"; if ($this->_em->query($query)) { //Borrar oficinas $query = "DELETE FROM {$oficinas->getDataBaseName()}.{$oficinas->getTableName()} where `IDBanco`='{$this->IDBanco}'"; if (!$this->_em->query($query)) { $this->_errores = $this->_em->getError(); } } else { $this->_errores = $this->_em->getError(); } $this->_em->desConecta(); } unset($this->_em); unset($oficinas); return count($this->_errores) == 0; }