✏️ 正在编辑: CorretorEmail.php
路径:
/srv/systems_dir/yuppiecred/application/models/CorretorEmail.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_CorretorEmail { private $_id; private $_corretorId; private $_emailAdicional; private $_descricao; public function getId() { return $this->_id; } public function getCorretorId() { return $this->_corretorId; } public function getEmailAdicional() { return $this->_emailAdicional; } public function getDescricao() { return $this->_descricao; } function getProtocolo() { return $this->_protocolo; } function getPendencia() { return $this->_pendencia; } function getChamado() { return $this->_chamado; } function getApoioComercial() { return $this->_apoioComercial; } function getReceberEmail() { return $this->_receberEmail; } public function setId($id) { $this->_id = $id; } public function setCorretorId($corretorId) { $this->_corretorId = $corretorId; } public function setEmailAdicional($emailAdicional) { $this->_emailAdicional = $emailAdicional; } public function setDescricao($descricao) { $this->_descricao = $descricao; } function setProtocolo($protocolo) { $this->_protocolo = $protocolo; } function setPendencia($pendencia) { $this->_pendencia = $pendencia; } function setChamado($chamado) { $this->_chamado = $chamado; } function setApoioComercial($apoioComercial) { $this->_apoioComercial = $apoioComercial; } function setReceberEmail($receberEmail) { $this->_receberEmail = $receberEmail; } 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_CorretorEmail(); $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_CorretorEmail $emailAdicional */ public function salvar(Model_CorretorEmail $emailAdicional) { $dbtable = new Model_DbTable_CorretorEmail(); if( $emailAdicional->getId() > 0 ){ $dbtable->update($emailAdicional->_toArray(), "id = " . $emailAdicional->getId()); return $emailAdicional->getId(); } else { return $dbtable->insert($emailAdicional->_toArray()); } } /** * @param $fields * @param string $order * @return Zend_Db_Table_Rowset_Abstract */ public function listar($fields, $order = 'id ASC') { $params = array(); $where = null; if( isset($fields['corretor_id']) && $fields['corretor_id'] > 0 ){ $params[] = "corretor_id = " . $fields['corretor_id']; } if( count($params) > 0 ){ $where = implode( " AND ", $params ); } $dbtable = new Model_DbTable_CorretorEmail(); return $dbtable->fetchAll($where, $order); } /** * 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_CorretorEmail(); return $dbtable->delete("id = " . $id); } return null; } /** * 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_CorretorEmail(); return $dbtable->fetchRow("id = " . $id); } }
💾 保存文件
← 返回文件管理器