protected function joinHasRelation(Relations\HasOneOrMany $relation, $type) { $table = $relation->getRelated()->getTable(); $foreignKey = $relation->getForeignKey(); $localKey = $relation->getQualifiedParentKeyName(); $this->query->join($table, $foreignKey, '=', $localKey, $type); }
private function generateJoinFromHasOneOrMany(HasOneOrMany $relation) { $parentKey = $relation->getQualifiedParentKeyName(); $parentKey = !empty($parentKey) ? $parentKey : $this->parent->getQualifiedKeyName(); // Related Table Generated On $generatedOnClause = [$relation->getForeignKey(), $parentKey]; // Related Table Join $this->generateJoin($this->related->getTable(), $this->compileOns($generatedOnClause), $this->nested ? $this->conditions[$this->index] : $this->conditions); }