parent
4a791e6204
commit
e655699917
|
@ -263,11 +263,13 @@ abstract class Repository implements Selectable
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the datasource being used
|
* Return the datasource being used for the table $table
|
||||||
|
*
|
||||||
|
* @param string $table
|
||||||
*
|
*
|
||||||
* @return Selectable
|
* @return Selectable
|
||||||
*/
|
*/
|
||||||
public function getDataSource()
|
public function getDataSource($table = null)
|
||||||
{
|
{
|
||||||
return $this->ds;
|
return $this->ds;
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera
|
||||||
*/
|
*/
|
||||||
public function from($target, array $columns = null)
|
public function from($target, array $columns = null)
|
||||||
{
|
{
|
||||||
$this->query = $this->repository->getDataSource()->select();
|
$this->query = $this->repository->getDataSource($target)->select();
|
||||||
$this->query->from($this->repository->requireTable($target, $this));
|
$this->query->from($this->repository->requireTable($target, $this));
|
||||||
$this->query->columns($this->prepareQueryColumns($target, $columns));
|
$this->query->columns($this->prepareQueryColumns($target, $columns));
|
||||||
$this->target = $target;
|
$this->target = $target;
|
||||||
|
@ -716,7 +716,7 @@ class RepositoryQuery implements QueryInterface, SortRules, FilterColumns, Itera
|
||||||
if ($this->query instanceof Traversable) {
|
if ($this->query instanceof Traversable) {
|
||||||
$iterator = $this->query;
|
$iterator = $this->query;
|
||||||
} else {
|
} else {
|
||||||
$iterator = $this->repository->getDataSource()->query($this->query);
|
$iterator = $this->repository->getDataSource($this->target)->query($this->query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($iterator instanceof IteratorAggregate) {
|
if ($iterator instanceof IteratorAggregate) {
|
||||||
|
|
Loading…
Reference in New Issue