for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace suda\application\database;
use suda\orm\TableStruct;
trait TableMiddlewareTrait
{
/**
* 处理输入数据
*
* @param string $name
* @param mixed $data
* @return mixed
*/
public function input(string $name, $data)
$methodName = '_input'.ucfirst($name).'Field';
if (\method_exists($this, $methodName)) {
return $this->$methodName($data);
}
return $data;
* 处理输出数据
public function output(string $name, $data)
$methodName = '_output'.ucfirst($name).'Field';
* 对输出列进行处理
* @param mixed $row
public function outputRow($row)
$methodName = '_outputDataFilter';
return $this->$methodName($row);
return $row;
* 输入参数名
* @return string
public function inputName(string $name):string
return $name;
* 输出参数名
public function outputName(string $name):string