From 4c78c021b36e6f67b2f01db93cafecf13194838c Mon Sep 17 00:00:00 2001 From: liugang Date: Fri, 8 Nov 2024 13:48:03 +0800 Subject: [PATCH] - [refac] remove unused append method. --- lib/base/mao/mao.class.php | 55 +------------------------------------- 1 file changed, 1 insertion(+), 54 deletions(-) diff --git a/lib/base/mao/mao.class.php b/lib/base/mao/mao.class.php index 116017b926..ef085380ce 100644 --- a/lib/base/mao/mao.class.php +++ b/lib/base/mao/mao.class.php @@ -475,59 +475,6 @@ class baseMao return $this; } - /** - * data追加字段。 - * Append field to data. - * - * @param string $tableName - * @param string $fields - * @access public - * @return static|cache. - */ - public function append(string $tableName, string $fields) - { - $fields = explode(',', $fields); - - $alias = []; - foreach($fields as $field) - { - $fieldInfo = explode(' ', trim($field)); - if(count($fieldInfo) == 1) - { - $alias[$fieldInfo[0]] = $fieldInfo[0]; - } - elseif(count($fieldInfo) == 2) - { - $alias[$fieldInfo[0]] = $fieldInfo[1]; - } - else - { - $alias[$fieldInfo[0]] = $fieldInfo[2]; - } - } - - $cacheKeys = []; - $key = $this->dataColumn; - foreach($this->data as $row) - { - if(!in_array($row->$key, $cacheKeys)) $cacheKeys[] = $row->$key; - } - $objects = $this->cache->fetchAll($tableName, $cacheKeys); - foreach($this->data as $row) - { - $object = $objects[$row->$key]; - foreach($alias as $aliasKey => $aliasValue) - { - $row->$aliasValue = $object->$aliasKey; - } - } - - return $this; - } - - - //-------------------- Fetch相关方法(Fetch related methods) -------------------// - /** * 判断匹配条件。 * Check condition is matched. @@ -776,7 +723,7 @@ class baseMao $cacheResult = $this->cache->fetchAll($this->table, array_unique($keyList)); - foreach($data as $index=> $row) + foreach($data as $index => $row) { $key = $keyList[$index]; $cacheRow = $cacheResult[$key];