src/MVC/Relations/BelongsTo.php
protected function getType($model, $related, $local, $remote)
    {
        $modelObject = new $model();
        $remoteObject = new $related();
        //
        $tablemodel = $this->getTable($modelObject);
        $tableremote = $this->getTable($remoteObject);
        //
        if (is_null($local) && is_null($remote)) {
            $model = $tablemodel.'_id';
            $remote = $tableremote.'_id';
        } else {
            $model = $remote;
        }
        //
        if (in_array(strtolower($model), $remoteObject->_columns)) {
            $this->relation = OneToOneRelation;
        }
        if (in_array(strtolower($remote), $modelObject->_columns)) {
            $this->relation = OneToManyRelation;
        }
        //
        return $this->relation;
    }
protected function getType($model, $related, $local, $remote)
    {
        $modelObject = new $model();
        $remoteObject = new $related();
        //
        $tablemodel = $this->getTable($modelObject);
        $tableremote = $this->getTable($remoteObject);
        //
        if (is_null($local) && is_null($remote)) {
            $model = $tablemodel.'_id';
            $remote = $tableremote.'_id';
        } else {
            $model = $remote;
        }
        //
        if (in_array(strtolower($model), $remoteObject->_columns)) {
            $this->relation = OneToOneRelation;
        }
        if (in_array(strtolower($remote), $modelObject->_columns)) {
            $this->relation = OneToManyRelation;
        }
        //
        return $this->relation;
    }
protected function getType ( $ model , $ related , $ local , $ remote ) { $ modelObject = new $ model ( ) ; $ remoteObject = new $ related ( ) ; // $ tablemodel = $ this -> getTable ( $ modelObject ) ; $ tableremote = $ this -> getTable ( $ remoteObject ) ; // if ( is_null ( $ local ) && is_null ( $ remote ) ) { $ model = $ tablemodel . '_id' ; $ remote = $ tableremote . '_id' ; } else { $ model = $ remote ; } // if ( in_array ( strtolower ( $ model ) , $ remoteObject -> _columns ) ) { $ this -> relation = OneToOneRelation ; } if ( in_array ( strtolower ( $ remote ) , $ modelObject -> _columns ) ) { $ this -> relation = OneToManyRelation ; } // return $ this -> relation ; }
get the type of relation.

@param $model string
get the type of relation .