top-think / top-think/think-orm

【field】和【withoutField】失效问题【暂时解决】

Open
#256 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Description

BaseQuery.php类内,public function field($field) 和 public function withoutField($field) 这两个方法,分别在各自的倒数第三行加一句unset($field[0]); 剔除 * 星号。
WTF!!!!!!!!!!!!!!!!!!!!
ps: 倒数第三行
if (isset($this->options['field'])) {
$field = array_merge((array) $this->options['field'], $field);
}
unset($field[0]);
$this->options['field'] = array_unique($field);
return $this;

另外:
1, if (true === $field) { 这个判断是干嘛的?都不会走进去。
2,getTableFields这个方法没有实现,干嘛的?干嘛的?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in BaseQuery.php by reading field($field) and withoutField($field), including the reported unset($field[0]) location and the if (true === $field) branch. Inspect getTableFields as well, then reproduce the wildcard-field behavior and clarify the intended final behavior before deciding what completion means.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.