system/classes/Model.php
protected function _getModelsFromTableColumn($attributeName, $objName, $relationColumnName, $query = false, $loadMap = false)
    {
      // Figure out the unique identifying field of the model we want to grab.
      $relatedObj = $this->fetchRelatedObj($objName);
      $idField = $relatedObj->getPrimaryKey();

      //$relatedClassName = strtolower((new \ReflectionClass($relatedObj))->getShortName());
      $repo = \Cora\RepositoryFactory::make($objName, false, false, false, $this->model_db);

      // If no query object was passed in, then grab an appropriate one.
      if (!$query) $query = $this->_getQueryObjectForRelation($attributeName);

      // Set association condition
      $query->where($relationColumnName, $this->{$this->getPrimaryKey()});

      return $repo->findAll($query, false, $loadMap);
    }
protected function _getModelsFromTableColumn($attributeName, $objName, $relationColumnName, $query = false, $loadMap = false)
    {
      // Figure out the unique identifying field of the model we want to grab.
      $relatedObj = $this->fetchRelatedObj($objName);
      $idField = $relatedObj->getPrimaryKey();

      //$relatedClassName = strtolower((new \ReflectionClass($relatedObj))->getShortName());
      $repo = \Cora\RepositoryFactory::make($objName, false, false, false, $this->model_db);

      // If no query object was passed in, then grab an appropriate one.
      if (!$query) $query = $this->_getQueryObjectForRelation($attributeName);

      // Set association condition
      $query->where($relationColumnName, $this->{$this->getPrimaryKey()});

      return $repo->findAll($query, false, $loadMap);
    }
protected function _getModelsFromTableColumn ( $ attributeName , $ objName , $ relationColumnName , $ query = false , $ loadMap = false ) { // Figure out the unique identifying field of the model we want to grab. $ relatedObj = $ this -> fetchRelatedObj ( $ objName ) ; $ idField = $ relatedObj -> getPrimaryKey ( ) ; //$relatedClassName = strtolower((new \ReflectionClass($relatedObj))->getShortName()); $ repo = \ Cora \ RepositoryFactory :: make ( $ objName , false , false , false , $ this -> model_db ) ; // If no query object was passed in, then grab an appropriate one. if ( ! $ query ) $ query = $ this -> _getQueryObjectForRelation ( $ attributeName ) ; // Set association condition $ query -> where ( $ relationColumnName , $ this -> { $ this -> getPrimaryKey ( ) } ) ; return $ repo -> findAll ( $ query , false , $ loadMap ) ; }
The Related Obj's table should have some sort of 'owner' column
for us to fetch by.
The Related Obj s table should have some sort of owner column for us to fetch by .