private function hasOne()
    {
        // Return if there are no relationships of that type
        if (!isset($this->relationships['hasOne']) || empty($this->relationships['hasOne'])) {
            return $this;
        }

        // Iterate relationships
        foreach ($this->relationships['hasOne'] as $join) {

            // Perform join
            $this->db()->join($join['table'], $join['localKey'], '=', $join['foreignKey']);

            // Add related columns to select
            foreach ($join['columns'] as $column) {
                $column = $join['table'] . '.' . $column . ' as _' . $join['alias'] . '_' . $column;
                $this->db()->addSelect($column);
            }
        }

        // Return model instance
        return $this;
    }
private function hasOne()
    {
        // Return if there are no relationships of that type
        if (!isset($this->relationships['hasOne']) || empty($this->relationships['hasOne'])) {
            return $this;
        }

        // Iterate relationships
        foreach ($this->relationships['hasOne'] as $join) {

            // Perform join
            $this->db()->join($join['table'], $join['localKey'], '=', $join['foreignKey']);

            // Add related columns to select
            foreach ($join['columns'] as $column) {
                $column = $join['table'] . '.' . $column . ' as _' . $join['alias'] . '_' . $column;
                $this->db()->addSelect($column);
            }
        }

        // Return model instance
        return $this;
    }
private function hasOne ( ) { // Return if there are no relationships of that type if ( ! isset ( $ this -> relationships [ 'hasOne' ] ) || empty ( $ this -> relationships [ 'hasOne' ] ) ) { return $ this ; } // Iterate relationships foreach ( $ this -> relationships [ 'hasOne' ] as $ join ) { // Perform join $ this -> db ( ) -> join ( $ join [ 'table' ] , $ join [ 'localKey' ] , '=' , $ join [ 'foreignKey' ] ) ; // Add related columns to select foreach ( $ join [ 'columns' ] as $ column ) { $ column = $ join [ 'table' ] . '.' . $ column . ' as _' . $ join [ 'alias' ] . '_' . $ column ; $ this -> db ( ) -> addSelect ( $ column ) ; } } // Return model instance return $ this ; }
Resolves one to one relationships

@return object Model instance
Resolves one to one relationships