✏️ 正在编辑: SincYuppies.php
路径:
/srv/systems_dir/yuppiecred/application/models/SincYuppies.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php class Model_SincYuppies { private $_id; private $_token; private $_sistema; private $_ultimaSincronizacao; private $_subestabelecidoId; private $_dominio; public function getId() { return $this->_id; } public function setId($id) { $this->_id = $id; } public function getToken() { return $this->_token; } public function setToken($token) { $this->_token = $token; return $this; } public function getSistema() { return $this->_sistema; } public function setSistema($sistema) { $this->_sistema = $sistema; } public function getUltimaSincronizacao() { return $this->_ultimaSincronizacao; } public function setUltimaSincronizacao($ultimaSincronizacao) { $this->_ultimaSincronizacao = $ultimaSincronizacao; } function getSubestabelecidoId() { return $this->_subestabelecidoId; } function setSubestabelecidoId($subestabelecidoId) { $this->_subestabelecidoId = $subestabelecidoId; } public function getDominio() { return $this->_dominio; } public function setDominio($dominio): void { $this->_dominio = $dominio; } 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_SincYuppies(); $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; } /** * Retorna uma lista * @param string $where * @param string $order * @param int $count * @param int $offset * @return array */ public function listar($fields, $order = "id ASC") { $params = array(); $usuario = Yuppie_Auth::getIdentity(); $params[] = "excluido <> 1"; foreach ($fields as $key => $value){ $params[] = "$key = '$value'"; } if( count($params) > 0 ) $where = implode(" AND ", $params); $dbtable = new Model_DbTable_SincYuppies(); return $dbtable->fetchAll($where, $order); } /** * 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_SincYuppies(); return $dbtable->fetchRow("id = " . $id); } /** * Insere ou altera o token passado por parâmetro * @param Model_Corretor $corretor */ public function salvar(Model_SincYuppies $sinc) { $dbtable = new Model_DbTable_SincYuppies(); if( $sinc->getId() > 0 ){ $result = $dbtable->update($sinc->_toArray(), 'id = ' . $sinc->getId()); if( $result > 0 ){ return $sinc->getId(); } else { return null; } } else { return $dbtable->insert($sinc->_toArray()); } } public function excluir($id) { if ($id > 0) { $dbtable = new Model_DbTable_SincYuppies(); return $dbtable->delete("id = " . $id); } return null; } }
💾 保存文件
← 返回文件管理器