private function getColumnSchemaForColumnReference($columnReference, $fromModelSchema)
    {
        if (strpos($columnReference, ".") !== false) {
            $parts = explode(".", $columnReference);

            $relationshipName = $parts[0];

            $this->ensureRelationshipsArePopulated();
            $relationships = &Application::current()->getSharedArray("ModelRelationships");

            if (isset($relationships[$this->modelName][$relationshipName])) {
                $relationship = $relationships[$this->modelName][$relationshipName];
                $relatedModel = SolutionSchema::getModel($relationship->getTargetModelName());

                return $relatedModel->getColumnSchemaForColumnReference($parts[1], $fromModelSchema);
            }
        }

        $schema = $fromModelSchema ? $this->getSchema() : $this->getRepository()->getRepositorySchema();
        $columns = $schema->getColumns();

        if (isset($columns[$columnReference])) {
            return $columns[$columnReference];
        }

        return null;
    }
private function getColumnSchemaForColumnReference($columnReference, $fromModelSchema)
    {
        if (strpos($columnReference, ".") !== false) {
            $parts = explode(".", $columnReference);

            $relationshipName = $parts[0];

            $this->ensureRelationshipsArePopulated();
            $relationships = &Application::current()->getSharedArray("ModelRelationships");

            if (isset($relationships[$this->modelName][$relationshipName])) {
                $relationship = $relationships[$this->modelName][$relationshipName];
                $relatedModel = SolutionSchema::getModel($relationship->getTargetModelName());

                return $relatedModel->getColumnSchemaForColumnReference($parts[1], $fromModelSchema);
            }
        }

        $schema = $fromModelSchema ? $this->getSchema() : $this->getRepository()->getRepositorySchema();
        $columns = $schema->getColumns();

        if (isset($columns[$columnReference])) {
            return $columns[$columnReference];
        }

        return null;
    }
private function getColumnSchemaForColumnReference ( $ columnReference , $ fromModelSchema ) { if ( strpos ( $ columnReference , "." ) !== false ) { $ parts = explode ( "." , $ columnReference ) ; $ relationshipName = $ parts [ 0 ] ; $ this -> ensureRelationshipsArePopulated ( ) ; $ relationships = & Application :: current ( ) -> getSharedArray ( "ModelRelationships" ) ; if ( isset ( $ relationships [ $ this -> modelName ] [ $ relationshipName ] ) ) { $ relationship = $ relationships [ $ this -> modelName ] [ $ relationshipName ] ; $ relatedModel = SolutionSchema :: getModel ( $ relationship -> getTargetModelName ( ) ) ; return $ relatedModel -> getColumnSchemaForColumnReference ( $ parts [ 1 ] , $ fromModelSchema ) ; } } $ schema = $ fromModelSchema ? $ this -> getSchema ( ) : $ this -> getRepository ( ) -> getRepositorySchema ( ) ; $ columns = $ schema -> getColumns ( ) ; if ( isset ( $ columns [ $ columnReference ] ) ) { return $ columns [ $ columnReference ] ; } return null ; }
Returns the schema Column object for the matching column reference.

A column reference might be a column name or a Relationship.ColumnName expressions.

@param string $columnReference
@param bool $fromModelSchema True to use model schema, false to use repository schema
@return null|\Rhubarb\Stem\Schema\Columns\Column
Returns the schema Column object for the matching column reference .