protected function getReferencingField($table, $name)
    {
        $references = $this->getReferences();
        $rf = null;
        foreach ($references as $item) {
            if ($item->refTable === $table && $table . '_by_' . implode('_', $item->refField) === $name) {
                $rf = $item->refField[0];
                break;
            }
        }

        return $rf;
    }
protected function getReferencingField($table, $name)
    {
        $references = $this->getReferences();
        $rf = null;
        foreach ($references as $item) {
            if ($item->refTable === $table && $table . '_by_' . implode('_', $item->refField) === $name) {
                $rf = $item->refField[0];
                break;
            }
        }

        return $rf;
    }
protected function getReferencingField ( $ table , $ name ) { $ references = $ this -> getReferences ( ) ; $ rf = null ; foreach ( $ references as $ item ) { if ( $ item -> refTable === $ table && $ table . '_by_' . implode ( '_' , $ item -> refField ) === $ name ) { $ rf = $ item -> refField [ 0 ] ; break ; } } return $ rf ; }
Gets the foreign key of the referenced table

@param string $table
@param string $name

@return mixed|null
Gets the foreign key of the referenced table