src/Services/PDOs/Builders/Builder.php
protected function getRelation($entity, $method)
    {
        // We need to check the relationship method only at the first local entity, because all entities must be of the same class.
        if (!method_exists($entity, $method)) {
            throw new LogicException('Call to undefined relationship "' . $method . '" on model "' . get_class($entity) . '".');
        }

        // Create a Relation without any constrains.
        $relation = \Core\Models\Relation::noConstraints(function() use ($entity, $method) {
            return $entity->$method();
        });

        if (!$relation instanceof Relation) {
            throw new LogicException('Relationship method "' . $method . '" must return an object of type Core\Models\Contracts\Relation.');
        }

        return $relation;
    }
protected function getRelation($entity, $method)
    {
        // We need to check the relationship method only at the first local entity, because all entities must be of the same class.
        if (!method_exists($entity, $method)) {
            throw new LogicException('Call to undefined relationship "' . $method . '" on model "' . get_class($entity) . '".');
        }

        // Create a Relation without any constrains.
        $relation = \Core\Models\Relation::noConstraints(function() use ($entity, $method) {
            return $entity->$method();
        });

        if (!$relation instanceof Relation) {
            throw new LogicException('Relationship method "' . $method . '" must return an object of type Core\Models\Contracts\Relation.');
        }

        return $relation;
    }
protected function getRelation ( $ entity , $ method ) { // We need to check the relationship method only at the first local entity, because all entities must be of the same class. if ( ! method_exists ( $ entity , $ method ) ) { throw new LogicException ( 'Call to undefined relationship "' . $ method . '" on model "' . get_class ( $ entity ) . '".' ) ; } // Create a Relation without any constrains. $ relation = \ Core \ Models \ Relation :: noConstraints ( function ( ) use ( $ entity , $ method ) { return $ entity -> $ method ( ) ; } ) ; if ( ! $ relation instanceof Relation ) { throw new LogicException ( 'Relationship method "' . $ method . '" must return an object of type Core\Models\Contracts\Relation.' ) ; } return $ relation ; }
Get the relation instance for the given relationship method.

@param Model $entity Instance of the local entity.
@param string $method Name of the relationship method.
@return Relation
Get the relation instance for the given relationship method .