system/classes/Model.php
public function getModelsFromCustomRelationship($attributeName, $objName, $query = false, $loadMap = false)
     {
      // Create a repository for the related object.
      $repo = \Cora\RepositoryFactory::make($objName, false, false, false, $this->model_db);
      
      // Grab a Query Builder object for the connection this related model uses.
      // If no query object was passed in, then grab an appropriate one.
      if (!$query) $query = $this->_getQueryObjectForRelation($attributeName);

      // Grab the name of the method that defines the relationship
      $definingFunctionName = $this->model_attributes[$attributeName]['using'];
      
      // Pass query to the defining function
      $query = $this->$definingFunctionName($query);
      
      return $repo->findAll($query, false, $loadMap);
     }
public function getModelsFromCustomRelationship($attributeName, $objName, $query = false, $loadMap = false)
     {
      // Create a repository for the related object.
      $repo = \Cora\RepositoryFactory::make($objName, false, false, false, $this->model_db);
      
      // Grab a Query Builder object for the connection this related model uses.
      // If no query object was passed in, then grab an appropriate one.
      if (!$query) $query = $this->_getQueryObjectForRelation($attributeName);

      // Grab the name of the method that defines the relationship
      $definingFunctionName = $this->model_attributes[$attributeName]['using'];
      
      // Pass query to the defining function
      $query = $this->$definingFunctionName($query);
      
      return $repo->findAll($query, false, $loadMap);
     }
The Related Obj's are defined by a custom query. A "using" definition states which model
method defines the relationship. Within that method any query parameters must bet set and
a Query Builder object returned.