Query类value和column增加对调用field链式操作方法的处理

This commit is contained in:
thinkphp
2016-05-06 18:31:43 +08:00
parent a00df4246e
commit 583af3aed6

View File

@@ -107,6 +107,9 @@ class Query
$result = Cache::get($key); $result = Cache::get($key);
} }
if (!$result) { if (!$result) {
if (isset($this->options['field'])) {
unset($this->options['field']);
}
$pdo = $this->field($field)->fetchPdo(true)->find(); $pdo = $this->field($field)->fetchPdo(true)->find();
$result = $pdo->fetchColumn(); $result = $pdo->fetchColumn();
if (isset($cache)) { if (isset($cache)) {
@@ -137,6 +140,9 @@ class Query
$result = Cache::get($guid); $result = Cache::get($guid);
} }
if (!$result) { if (!$result) {
if (isset($this->options['field'])) {
unset($this->options['field']);
}
if ($key && '*' != $field) { if ($key && '*' != $field) {
$field = $key . ',' . $field; $field = $key . ',' . $field;
} }
@@ -642,14 +648,13 @@ class Query
$page = isset($config['page']) ? (int) $config['page'] : call_user_func([ $page = isset($config['page']) ? (int) $config['page'] : call_user_func([
$class, $class,
'getCurrentPage' 'getCurrentPage',
], $config['var_page']); ], $config['var_page']);
$page = $page < 1 ? 1 : $page; $page = $page < 1 ? 1 : $page;
$config['path'] = isset($config['path']) ? $config['path'] : call_user_func([$class, 'getCurrentPath']); $config['path'] = isset($config['path']) ? $config['path'] : call_user_func([$class, 'getCurrentPath']);
/** @var Paginator $paginator */ /** @var Paginator $paginator */
if (!$simple) { if (!$simple) {
$options = $this->getOptions(); $options = $this->getOptions();