Skip to content

Commit

Permalink
Query::utilize(): Allow arrays as argument type too
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Nov 5, 2021
1 parent d905ab6 commit bbfcb24
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,16 @@ public function getUtilize()
/**
* Add a relation to utilize (join)
*
* @param string $path
* @param string|string[] $paths
*
* @return $this
*/
public function utilize($path)
public function utilize($paths)
{
$path = $this->getResolver()->qualifyPath($path, $this->getModel()->getTableName());
$this->utilize[$path] = $this->getResolver()->resolveRelation($path);
foreach ((array) $paths as $path) {
$path = $this->getResolver()->qualifyPath($path, $this->getModel()->getTableName());
$this->utilize[$path] = $this->getResolver()->resolveRelation($path);
}

return $this;
}
Expand Down

0 comments on commit bbfcb24

Please sign in to comment.