src/ORM/DataObject.php
public function getRelationClass($relationName)
    {
        // Parse many_many
        $manyManyComponent = $this->getSchema()->manyManyComponent(static::class, $relationName);
        if ($manyManyComponent) {
            return $manyManyComponent['childClass'];
        }

        // Go through all relationship configuration fields.
        $config = $this->config();
        $candidates = array_merge(
            ($relations = $config->get('has_one')) ? $relations : array(),
            ($relations = $config->get('has_many')) ? $relations : array(),
            ($relations = $config->get('belongs_to')) ? $relations : array()
        );

        if (isset($candidates[$relationName])) {
            $remoteClass = $candidates[$relationName];

            // If dot notation is present, extract just the first part that contains the class.
            if (($fieldPos = strpos($remoteClass, '.')) !== false) {
                return substr($remoteClass, 0, $fieldPos);
            }

            // Otherwise just return the class
            return $remoteClass;
        }

        return null;
    }
public function getRelationClass($relationName)
    {
        // Parse many_many
        $manyManyComponent = $this->getSchema()->manyManyComponent(static::class, $relationName);
        if ($manyManyComponent) {
            return $manyManyComponent['childClass'];
        }

        // Go through all relationship configuration fields.
        $config = $this->config();
        $candidates = array_merge(
            ($relations = $config->get('has_one')) ? $relations : array(),
            ($relations = $config->get('has_many')) ? $relations : array(),
            ($relations = $config->get('belongs_to')) ? $relations : array()
        );

        if (isset($candidates[$relationName])) {
            $remoteClass = $candidates[$relationName];

            // If dot notation is present, extract just the first part that contains the class.
            if (($fieldPos = strpos($remoteClass, '.')) !== false) {
                return substr($remoteClass, 0, $fieldPos);
            }

            // Otherwise just return the class
            return $remoteClass;
        }

        return null;
    }
public function getRelationClass ( $ relationName ) { // Parse many_many $ manyManyComponent = $ this -> getSchema ( ) -> manyManyComponent ( static :: class , $ relationName ) ; if ( $ manyManyComponent ) { return $ manyManyComponent [ 'childClass' ] ; } // Go through all relationship configuration fields. $ config = $ this -> config ( ) ; $ candidates = array_merge ( ( $ relations = $ config -> get ( 'has_one' ) ) ? $ relations : array ( ) , ( $ relations = $ config -> get ( 'has_many' ) ) ? $ relations : array ( ) , ( $ relations = $ config -> get ( 'belongs_to' ) ) ? $ relations : array ( ) ) ; if ( isset ( $ candidates [ $ relationName ] ) ) { $ remoteClass = $ candidates [ $ relationName ] ; // If dot notation is present, extract just the first part that contains the class. if ( ( $ fieldPos = strpos ( $ remoteClass , '.' ) ) !== false ) { return substr ( $ remoteClass , 0 , $ fieldPos ) ; } // Otherwise just return the class return $ remoteClass ; } return null ; }
Find the foreign class of a relation on this DataObject, regardless of the relation type.

@param string $relationName Relation name.
@return string Class name, or null if not found.
Find the foreign class of a relation on this DataObject regardless of the relation type .