Mudanças
This commit is contained in:
@@ -23,27 +23,27 @@ class BelongsToMany {
|
||||
}
|
||||
|
||||
function get() {
|
||||
|
||||
|
||||
$limitsSql = '';
|
||||
foreach ($this->remoteLimit as $key => $value) {
|
||||
$limitsSql .= "$key $value ";
|
||||
}
|
||||
|
||||
$pivotTable = '{' . $this->pivotTable . '}';
|
||||
$pivotTable = '{' . $this->pivotTable . '}';
|
||||
$sql = "SELECT $this->remoteInPivot FROM $pivotTable WHERE $this->localInPivot = ? $limitsSql";
|
||||
|
||||
|
||||
$relations = DBInstance::query($sql, Array($this->localObject->id), $this->localObject::_connectionName);
|
||||
|
||||
$ids = Array();
|
||||
|
||||
$ids = Array();
|
||||
foreach ($relations as $relation) {
|
||||
$ids[] = $relation->{$this->remoteInPivot};
|
||||
}
|
||||
|
||||
|
||||
if (empty($ids)) {
|
||||
return Array();
|
||||
}
|
||||
|
||||
return $this->foreignObject::findMany(array_merge(Array('id' => Array('IN', $ids)), $this->remoteFilter), Array('*'), $this->remoteLimit);
|
||||
|
||||
return $this->foreignObject::findMany(array_merge(Array('id' => Array('IN', $ids)), $this->remoteFilter), Array('*'), $this->remoteLimit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user