active-record
active-record copied to clipboard
The method allPopulate in ActiveQuery will execute populate twice during execution
What steps will reproduce the problem?
The method allPopulate in ActiveQuery will execute populate twice during execution.
Is this how it was designed or is it a bug ?
public function all(): array
{
if ($this->shouldEmulateExecution()) {
return [];
}
return $this->populate($this->createCommand()->queryAll(), $this->indexBy); // Repeated execution
}
public function allPopulate(): array
{
$rows = $this->all();
if ($rows !== []) {
$rows = $this->populate($rows, $this->indexBy); // Repeated execution
}
return $rows;
}
What is the expected result?
populate should only be executed once ?
What do you get instead?
populate executed twice
Additional info
| Q | A |
|---|---|
| Version | 1.0.? |
| PHP version | 8.1 |
| Operating system | windows 10 |