✏️ 正在编辑: Conta.php
路径:
/srv/systems_dir/yuppiecred-bkp/application/models/Conta.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_Conta { private $_id; private $_nome; private $_bancoId; private $_tipo; private $_agencia; private $_agenciaDv; private $_conta; private $_contaDv; private $_convenio; private $_formatacaoConvenio; private $_codigoCedente; private $_empresaId; public function getId() { return $this->_id; } public function setId($id) { $this->_id = $id; } public function getNome() { return $this->_nome; } public function setNome($nome) { $this->_nome = $nome; } public function getBancoId() { return $this->_bancoId; } public function getTipo() { return $this->_tipo; } public function getAgencia() { return $this->_agencia; } public function getAgenciaDv() { return $this->_agenciaDv; } public function getConta() { return $this->_conta; } public function getContaDv() { return $this->_contaDv; } public function getConvenio() { return $this->_convenio; } public function getCodigoCedente() { return $this->_codigoCedente; } public function getEmpresaId() { return $this->_empresaId; } public function setBancoId($bancoId) { $this->_bancoId = $bancoId; } public function setTipo($tipo) { $this->_tipo = $tipo; } public function setAgencia($agencia) { $this->_agencia = $agencia; } public function setAgenciaDv($agenciaDv) { $this->_agenciaDv = $agenciaDv; } public function setConta($conta) { $this->_conta = $conta; } public function setContaDv($contaDv) { $this->_contaDv = $contaDv; } public function setConvenio($convenio) { $this->_convenio = $convenio; } public function setCodigoCedente($codigoCedente) { $this->_codigoCedente = $codigoCedente; } public function setEmpresaId($empresaId) { $this->_empresaId = $empresaId; } public function __construct($options = null) { if( is_array($options) ){ $this->setOptions($options); } } public function setOptions(array $options) { $methods = get_class_methods($this); foreach ( $options as $key => $value ) { $explode = explode("_", $key); $methodName = ''; foreach ( $explode as $v ) { $methodName .= ucfirst($v); } $key = $methodName != '' ? $methodName : $key; $method = 'set' . ucfirst($key); if( in_array($method, $methods) ){ $this->$method($value); } } return $this; } public function _toArray() { $dbtable = new Model_DbTable_Conta(); $info = $dbtable->info(); $methods = get_class_methods($this); $data = array( ); foreach ( $info['cols'] as $key ) { $col = $key; $explode = explode("_", $key); $methodName = ''; foreach ( $explode as $v ) { $methodName .= ucfirst($v); } $key = $methodName != '' ? $methodName : $key; $method = 'get' . ucfirst($key); if( in_array($method, $methods) ){ $data[$col] = $this->$method(); } } return $data; } /** * Insere ou altera o registro passado por parâmetro * @param Model_Conta $conta */ public function salvar(Model_Conta $conta) { $dbtable = new Model_DbTable_Conta(); if( $conta->getId() > 0 ){ $dbtable->update($conta->_toArray(), ["id = ?" => $conta->getId()]); return $conta->getId(); } else { return $dbtable->insert($conta->_toArray()); } } /** * Exclui o registro passado por parâmetro * @param int $id * @return int The number of rows deleted */ public function excluir($id) { if( $id > 0 ){ $dbtable = new Model_DbTable_Conta(); return $dbtable->delete(["id = ?" => $id]); } return null; } /** * Retorna uma lista * @param string $where * @param string $order * @param int $count * @param int $offset * @return array */ public function listar($where = null, $order = null, $count = null, $offset = null) { $dbtable = new Model_DbTable_Conta(); return $dbtable->fetchAll($where, $order, $count, $offset); } /** * Retorna um fetchRow do item passado por parâmetro * @param int $id * @return Zend_Db_Table_Row_Abstract | null */ public function exibir($id) { $dbtable = new Model_DbTable_Conta(); return $dbtable->fetchRow(["id = ?" => $id]); } }
💾 保存文件
← 返回文件管理器