✏️ 正在编辑: CampanhaTabela.php
路径:
/srv/systems_dir/yuppiecred-lidernegocios/application/models/CampanhaTabela.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_CampanhaTabela { private $_id; private $_campanhaId; private $_tabelaId; public function getId() { return $this->_id; } public function setId($id) { $this->_id = $id; } public function getCampanhaId() { return $this->_campanhaId; } public function setCampanhaId($campanhaId) { $this->_campanhaId = $campanhaId; } public function getTabelaId() { return $this->_tabelaId; } public function setTabelaId($tabelaId) { $this->_tabelaId = $tabelaId; } 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_CampanhaTabela(); $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_CampanhaTabela $tabela) { $dbtable = new Model_DbTable_CampanhaTabela(); if( $tabela->getId() > 0 ){ $dbtable->update($tabela->_toArray(), "id = " . $tabela->getId()); return $tabela->getId(); } else { return $dbtable->insert($tabela->_toArray()); } } public function listar($where = null, $order = null, $count = null, $offset = null) { $dbtable = new Model_DbTable_CampanhaTabela(); return $dbtable->fetchAll($where, $order, $count, $offset); } public function excluir($id) { if( $id > 0 ){ $dbtable = new Model_DbTable_CampanhaTabela(); return $dbtable->delete("id = " . $id); } return null; } }
💾 保存文件
← 返回文件管理器