取消Model类的create方法的第二个参数

This commit is contained in:
thinkphp
2016-02-09 20:27:31 +08:00
parent b63bda78d7
commit 6011b57561
2 changed files with 7 additions and 8 deletions

View File

@@ -900,11 +900,10 @@ class Model
* 创建数据对象 但不保存到数据库
* @access public
* @param mixed $data 创建数据
* @param string $type 状态
* @return mixed
* @throws \think\Exception
*/
public function create($data = '', $type = '')
public function create($data = '')
{
// 如果没有传值默认取POST数据
if (empty($data)) {
@@ -1007,7 +1006,7 @@ class Model
}
}
// 过滤创建的数据
$this->_create_filter($data, $type);
$this->_create_filter($data);
// 赋值当前数据对象
$this->data = $data;
// 返回创建的数据以供其他调用

View File

@@ -70,12 +70,12 @@ trait Auto
}
// 数据自动验证
if (!$this->autoValidation($data, $type)) {
if (!$this->_autoValidation($data, $type)) {
return false;
}
// 验证完成生成数据对象
if ($this->autoCheckFields && empty($this->options['link'])) {
if (empty($this->options['link'])) {
// 开启字段检测并且没有关联表 则过滤非法字段数据
$fields = $this->getFields();
foreach ($keys as $i => $key) {
@@ -86,7 +86,7 @@ trait Auto
}
// 创建完成对数据进行自动处理
$this->autoOperation($data, $type);
$this->_autoOperation($data, $type);
// 验证后的回调方法
$this->_after_create($data, $this->options);
// 赋值当前数据对象
@@ -134,7 +134,7 @@ trait Auto
* @param string $type 创建类型
* @return mixed
*/
private function autoOperation(&$data, $type)
protected function _autoOperation(&$data, $type)
{
if (isset($this->options['auto'])) {
if (false === $this->options['auto']) {
@@ -239,7 +239,7 @@ trait Auto
* @param string $type 创建类型
* @return boolean
*/
protected function autoValidation(&$data, $type)
protected function _autoValidation(&$data, $type)
{
if (isset($this->options['validate'])) {
if (false === $this->options['validate']) {