✏️ 正在编辑: Performance.php
路径:
/srv/systems_dir/yuppiecred/application/models/Performance.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_Performance { private $_id; private $_bancoId; private $_convenioId; private $_percentual; public function getId() { return $this->_id; } public function getBancoId() { return $this->_bancoId; } public function getConvenioId() { return $this->_convenioId; } public function getPercentual() { return $this->_percentual; } public function setId($id) { $this->_id = $id; } public function setBancoId($bancoId) { $this->_bancoId = $bancoId; } public function setConvenioId($convenioId) { $this->_convenioId = $convenioId; } public function setPercentual($percentual) { $this->_percentual = $percentual; } 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_Performance(); $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; } public function salvar(Model_Performance $performance) { $dbtable = new Model_DbTable_Performance(); if( $performance->getId() > 0 ){ $dbtable->update($performance->_toArray(), "id = " . $performance->getId()); return $performance->getId(); } else { return $dbtable->insert($performance->_toArray()); } } public function exibir($id) { $dbtable = new Model_DbTable_Performance(); return $dbtable->fetchRow("id = " . $id); } public function excluir($id) { if( $id > 0 ){ $dbtable = new Model_DbTable_Performance(); return $dbtable->delete("id = " . $id); } return null; } public function listar($where = null, $order = null, $count = null, $offset = null) { $dbtable = new Model_DbTable_Performance(); return $dbtable->fetchAll($where, $order, $count, $offset); } public function getPaginatorAdapter($fields = null, $order = "id DESC") { $params = array(); $where = null; if(isset($fields['banco_id']) && !empty($fields['banco_id'])){ $params[] = "banco_id = " . $fields['banco_id']; } if(isset($fields['convenio_id']) && !empty($fields['convenio_id'])){ $params[] = "convenio_id = " . $fields['convenio_id']; } if( count($params) > 0 ) $where = implode( " AND ", $params); $dbtable = new Model_DbTable_Performance(); $select = $dbtable->select(); if( $where != null ) $select->where( $where); if( $order != null ) $select->order( $order); return new Zend_Paginator_Adapter_DbTableSelect($select); } }
💾 保存文件
← 返回文件管理器