✏️ 正在编辑: Fornecedor.php
路径:
/srv/systems_dir/yuppiecred/application/models/Fornecedor.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_Fornecedor extends Model_PessoaJuridica { private $_obs; private $_banco; private $_agencia; private $_conta; private $_tipoConta; //Corrente / Poupança private $_titular; private $_cpfTitular; private $_tipo; private $_nome; private $_chavePix; public function getNome() { return $this->_nome; } public function setNome($nome) { $this->_nome = $nome; } public function getTipo() { return $this->_tipo; } public function setTipo($tipo) { $this->_tipo = $tipo; } //<editor-fold> public function getObs() { return $this->_obs; } public function setObs($obs) { $this->_obs = $obs; } public function getBanco() { return $this->_banco; } public function setBanco($banco) { $this->_banco = $banco; } public function getAgencia() { return $this->_agencia; } public function setAgencia($agencia) { $this->_agencia = $agencia; } public function getConta() { return $this->_conta; } public function setConta($conta) { $this->_conta = $conta; } public function getTipoConta() { return $this->_tipoConta; } public function setTipoConta($tipoConta) { $this->_tipoConta = $tipoConta; } public function getTitular() { return $this->_titular; } public function setTitular($titular) { $this->_titular = $titular; } public function getCpfTitular() { return $this->_cpfTitular; } public function setCpfTitular($cpfTitular) { $this->_cpfTitular = $cpfTitular; } public function getChavePix() { return $this->_chavePix; } public function setChavePix($chave) { $this->_chavePix = $chave; } //</editor-fold> 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_Fornecedor(); $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(); } } $data['tipo'] = 'FORNECEDOR'; return $data; } /** * Insere ou altera o registro passado por parâmetro * @param Model_Fornecedor $fornecedor */ public function salvar(Model_Fornecedor $fornecedor) { $dbtable = new Model_DbTable_Fornecedor(); if( $fornecedor->getId() > 0 ){ $dbtable->update($fornecedor->_toArray(), "id = " . $fornecedor->getId()); return $fornecedor->getId(); } else { return $dbtable->insert($fornecedor->_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_Fornecedor(); return $dbtable->delete("id = " . $id); } return null; } /** * Retorna uma lista de empresas * @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_Fornecedor(); 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_Fornecedor(); return $dbtable->fetchRow("id = " . $id); } }
💾 保存文件
← 返回文件管理器