yiisoft / yiisoft/active-record
ActiveQuery::one() limiting database records
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 119
- Forks
- 38
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 1
Description
What steps will reproduce the problem?
ActiveQuery::one() doesn't seem to limit records in SQL.
What is the expected result?
Queries created with ActiveQuery::one() should have a LIMIT 1 clause in the prepared SQL.
What do you get instead?
The function selects all rows from a table resulting in excess memory consumption.
Additional info
| Q | A |
|---|---|
| Yii version | 2.0.? |
| PHP version | |
| Operating system |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ActiveQuery::one() and trace the prepared SQL it produces. Reproduce the query described in the issue, then verify that the generated SQL includes LIMIT 1 and that the query no longer selects all rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100