LazyRecord\Schema\Relationship\Relationship::newForeignForeignCollection PHP Method

newForeignForeignCollection() public method

This method is only for many-to-many relationship object.
public newForeignForeignCollection ( $junctionRelation ) : BaseCollection
return LazyRecord\BaseCollection The foreign foreign collection.
    public function newForeignForeignCollection($junctionRelation)
    {
        $junctionSchema = new $junctionRelation['foreign_schema']();
        $foreignRelation = $junctionSchema->getRelation($this['relation_foreign']);
        $collection = $foreignRelation->newForeignCollection();
        $this->applyFilter($collection);
        // apply this filter to the foreign collection.
        return $collection;
    }