改进关联查询方法relation

This commit is contained in:
thinkphp
2016-04-10 11:01:16 +08:00
parent 8b747500b3
commit 34538c2b02
2 changed files with 4 additions and 3 deletions

View File

@@ -590,6 +590,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
* 更新数据 * 更新数据
* @access public * @access public
* @param array $data 数据数组 * @param array $data 数据数组
* @param array $where 更新条件
* @return integer * @return integer
*/ */
public static function update($data = [], $where = []) public static function update($data = [], $where = [])
@@ -702,7 +703,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
* @param string|array $relations 关联名 * @param string|array $relations 关联名
* @return Model * @return Model
*/ */
public function relation($relations) public function relationQuery($relations)
{ {
if (is_string($relations)) { if (is_string($relations)) {
$relations = explode(',', $relations); $relations = explode(',', $relations);

View File

@@ -1947,7 +1947,7 @@ abstract class Driver
$result->isUpdate(true); $result->isUpdate(true);
// 关联查询 // 关联查询
if (!empty($options['relation'])) { if (!empty($options['relation'])) {
$result->relation($options['relation']); $result->relationQuery($options['relation']);
} }
} }
$resultSet[$key] = $result; $resultSet[$key] = $result;
@@ -2054,7 +2054,7 @@ abstract class Driver
$data->isUpdate(true); $data->isUpdate(true);
// 关联查询 // 关联查询
if (!empty($options['relation'])) { if (!empty($options['relation'])) {
$data->relation($options['relation']); $data->relationQuery($options['relation']);
} }
} }
} else { } else {