protected function declareOneToManyRelationship(
        $oneModelName,
        $oneColumnName,
        $oneNavigationName,
        $manyModelName,
        $manyColumnName = "",
        $manyNavigationName = ""
    ) {

        $oneToMany = new OneToMany($oneNavigationName, $oneModelName, $oneColumnName, $manyModelName, $manyColumnName);

        $this->addRelationship(
            $oneModelName,
            $oneNavigationName,
            $oneToMany
        );

        if ($manyColumnName == "") {
            $manyColumnName = $oneColumnName;
        }

        $oneToOne = $this->declareOneToOneRelationship(
            $manyModelName,
            $oneModelName,
            $manyColumnName,
            $oneColumnName,
            $manyNavigationName
        );
        $oneToOne->setOtherSide($oneToMany);
        $oneToMany->setOtherSide($oneToOne);

        return $oneToMany;
    }
protected function declareOneToManyRelationship(
        $oneModelName,
        $oneColumnName,
        $oneNavigationName,
        $manyModelName,
        $manyColumnName = "",
        $manyNavigationName = ""
    ) {

        $oneToMany = new OneToMany($oneNavigationName, $oneModelName, $oneColumnName, $manyModelName, $manyColumnName);

        $this->addRelationship(
            $oneModelName,
            $oneNavigationName,
            $oneToMany
        );

        if ($manyColumnName == "") {
            $manyColumnName = $oneColumnName;
        }

        $oneToOne = $this->declareOneToOneRelationship(
            $manyModelName,
            $oneModelName,
            $manyColumnName,
            $oneColumnName,
            $manyNavigationName
        );
        $oneToOne->setOtherSide($oneToMany);
        $oneToMany->setOtherSide($oneToOne);

        return $oneToMany;
    }
protected function declareOneToManyRelationship ( $ oneModelName , $ oneColumnName , $ oneNavigationName , $ manyModelName , $ manyColumnName = "" , $ manyNavigationName = "" ) { $ oneToMany = new OneToMany ( $ oneNavigationName , $ oneModelName , $ oneColumnName , $ manyModelName , $ manyColumnName ) ; $ this -> addRelationship ( $ oneModelName , $ oneNavigationName , $ oneToMany ) ; if ( $ manyColumnName == "" ) { $ manyColumnName = $ oneColumnName ; } $ oneToOne = $ this -> declareOneToOneRelationship ( $ manyModelName , $ oneModelName , $ manyColumnName , $ oneColumnName , $ manyNavigationName ) ; $ oneToOne -> setOtherSide ( $ oneToMany ) ; $ oneToMany -> setOtherSide ( $ oneToOne ) ; return $ oneToMany ; }
Defines a one to many relationship and a one to one reverse relationship.

@param    $oneModelName
@param    $oneColumnName
@param    $oneNavigationName
@param    $manyModelName
@param    $manyColumnName
@param    $manyNavigationName
@return   \Rhubarb\Stem\Schema\Relationships\OneToMany
@internal param $sourceModelName
@internal param $targetModelName
@internal param $sourceColumnName
@internal param $navigationName
Defines a one to many relationship and a one to one reverse relationship .