lazyrecord\schema\DeclareSchema::manyToMany PHP Method

manyToMany() public method

public manyToMany ( string $accessor, string $relationId, string $foreignRelationId )
$accessor string accessor name.
$relationId string a hasMany relationship.
$foreignRelationId string foreign relation id.
    public function manyToMany($accessor, $relationId, $foreignRelationId)
    {
        if ($r = $this->getRelation($relationId)) {
            return $this->relations[$accessor] = new Relationship($accessor, array('type' => Relationship::MANY_TO_MANY, 'relation_junction' => $relationId, 'relation_foreign' => $foreignRelationId));
        }
        throw new Exception("Relation {$relationId} is not defined.");
    }