模型类的get方法第一个参数必须 如果传入null则返回null

This commit is contained in:
thinkphp
2017-03-22 18:49:34 +08:00
parent 5a1cb9cea1
commit 08e0261ad3

View File

@@ -1294,11 +1294,15 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
* @param mixed $data 主键值或者查询条件(闭包)
* @param array|string $with 关联预查询
* @param bool $cache 是否缓存
* @return static
* @return static|null
* @throws exception\DbException
*/
public static function get($data = null, $with = [], $cache = false)
public static function get($data, $with = [], $cache = false)
{
if (is_null($data)) {
return null;
}
if (true === $with || is_int($with)) {
$cache = $with;
$with = [];